? on transformation
-
Where find is a entity, can someown tell me what the difference is between:
model_transformation=Geom::Transformation.new([0,0,0,point_vector)
find.transformation = model_transformation]
and:
find.transform! Geom::Transformation.new([0,0,0,point_vector)]
The different codes result in moving the entity "find" to different locations in the model. -
.transformation =
and.transform!
are different things. Transsform! will add one transformation onto another one. Lets say you have a component that sits at 10,10,10, and is already scaled to be 5 times its normal size. Then run this on itt = Geom::Transformation.scaling 2.0 my_comp.transform! t
That will take the existing transformation (of 10,10,10 location and 5x larger) and add the new transformation to it. We scale up by 2x. So after the transformation, the comp will 10x as big as the definition, and its location will move 2x away from the origin also. So if it was at 10,10,10 - it will move to 20,20,20 (I guess, I don't know my trig!).
Now if we run
t = Geom::Transformation.scaling 2.0 my_comp.transformation = t
This will reset the transformation that had been on the component (of 10,10,10 and 5x its original size), and make its transformation equal to the supplied one. So it will reset its location to 0,0,0 (because our transformation did not include a location to move to) and it will set its overall scale to just 2x larger. So in the end you get a component whose transformation equals the one supplied of location 0,0,0 and scale of 2x larger than the definition.
So the
.transform!
is like a compound transformation, or adding a transformation onto the existing one..transfomation =
is like setting the transformation equal to the supplied transformation, restting any transformation that might have previously been in place.Hope that makes sense.....hope that was what you were asking about!
Chris
EDIT: I changed a detail in the first example about the location, what I had written at first was incorrect.
-
Chris, thanks, yes that helps me to understand.
-
.transform!
uses the Group's or Instance's current Transformation and applies the new one (change by a Transformation).transformation=
simply replaces the Group's or Instance's Transformation with the new one (change to a Transformation.)For example, if you use the IDENTITY matrix:
entity.transform!(IDENTITY) - no change.
entity.transformation= IDENTITY - position, rotation and scaling are all reset.
Advertisement