Ruby transformation issue?
-
I'm trying to graphically explain the following coding problem I'm having, please see the attachment.
Under 5, I would like to use a move transformation of that face, only, to a new location, without it affecting the entire transformation which follows in 6. How would I code that move transformation to affect 5 only?
-
I don't think that
.move!
is really what you are after...
to rotate the group itself try...
group.transform!(t)
OR if you want to change the contents WITHIN the group use...
group.entities.transform_entities(t, group.entities.to_a)
If you want to JUST affect the 'base' inside the group use...
group.entities.transform_entities(t, base)
BUT 't' can be any 'transformation' you want...
-
the rotation works as written, It just happens the 4 new points defining the new face in 5 need to be moved/centered before 6 rotates all of these entities (think about moving a glass plane to the center of a window frame before the entire window frame and glass gets rotated)
The alternative naturally would be to simply create 4 new points defining a face at the center of the window frame. in which case I would not be asking for help. -
So as I thought I had explained... make a transformation [tb] for 'base' and use it just on that entity
group.entities.transform_entities(tb, **base**)
THEN make and use another transformation [t] on the whole 'group'...
Also note that your approximations of PI etc could be replaced by
60.degrees
or other values in degrees, to give consistently accurate angles...
Advertisement