[Request] Transformation rotation for animation help
-
I have done a search, because I have remembered it has been discussed already.
The Transformation Matrix thread.There is enough information there with examples of angles readouts.
Good luck
Tomasz -
@unknownuser said:
There is enough information there with examples of angles readouts.
Thanks very much Tomasz for that. I don't know how I missed it; I am always looking out for such topics.
I decided to understand a bit more and am currently studying Vector lessons.
So between the two I should get to where I want - the ability to interpret any skp model as a javascript array. My idea is to kind of sneak up on namesets from the rear, as opposed to previous full frontal assault!
Cheers
Chris
-
@chrisglasier said:
My idea is to kind of sneak up on namesets from the rear, as opposed to previous full frontal assault!
-
@chrisglasier said:
Can anyone help me to translate the x-, y- and zaxis results to degrees for each axis?
Vector3d.angle_between will get you part of the way there.
angle = t.zaxis.angle_between(Z_AXIS).degrees
However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ).
-
@jim said:
> angle = t.zaxis.angle_between(Z_AXIS).degrees >
However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ).
What..?! All you need to do to convert radians to degrees is appending
.degrees
? doh! -
-
@jim said:
@thomthom said:
What..?! All you need to do to convert radians to degrees is appending .degrees? doh!
Heh, see the Numeric documentation for the SketchUp-specific additions.
Meh,... I've seen that page, taking note of the unit conversion, but completely missed the ones relating to radians and degrees. goes of to clean up some scripts...
-
@jim said:
> angle = t.zaxis.angle_between(Z_AXIS).degrees >
However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ).
A quick pre-dinner try I get this with 90 deg rotation around X :
Now off to eat!
Chris
-
@chrisglasier said:
@jim said:
> > angle = t.zaxis.angle_between(Z_AXIS).degrees > >
However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ).
A quick pre-dinner try ...
... failed because I made
t = selection.transformation
, when it should be something related to vector3D ??
Also I don't understand the difference/relationship/source ofzaxis
and(Z_AXIS)
.Perhaps I have made it too confusing both here and also in this previous topic.
All I want to do is iterate through model entities to make each component and group a javascript array element, each with its own array of name/value couplets at least for xPos, yPos, zPos, xRot, yRot, zRot. The xyz business seems OK, where in an animation, for example, I can compare one entity's position with a new position to determine the translation. I want to do the same with rotations around each of the axes.
Sorry if I'm being rather painful, but I am sure a good result will help the mantra below.
Chris
-
Chris,
Z_AXIS, X_AXIS, and Y_AXIS are constants that are the vectors of SketchUp's global axes.
Here's a screenshot of a cube rotated 45 deg around the Z axis.
And I just noticed I said to use
.degrees
in an earlier post, sorry; it's.radians
.
-
@jim said:
Chris,
Z_AXIS, X_AXIS, and Y_AXIS are constants that are the vectors of SketchUp's global axes.
Here's a screenshot of a cube rotated 45 deg around the Z axis.
And I just noticed I said to use
.degrees
in an earlier post, sorry; it's.radians
.Jim I think the fog maybe clearing ... many thanks ... chris
-
I made a skp, rb, html set to test what I understand so far about transformations on a 3x4x5 metre group. If you want to try it out temporarily unzip the files to your plugin directory.
Here is a clip of it showing a group rotating around each of the axes in turn:
[flash=425,344:32q3oq38]http://www.youtube.com/v/aXxkHu7gSv4[/flash:32q3oq38]
The rotations are made with:
tr = Geom::Transformation.rotation(Geom::Point3d.new(ent.bounds.center), rv, theDegrees)
, where rv is the axis,and the angle_between values with:
(t.xaxis.angle_between X_AXIS).radians
- same for y and z.
From this, I gather if the angle_between values returned are 0-180-180, the group has been turned by 180 deg on the X_AXIS; and if 0_90_90, the group could have been turned 90 or 270 (-90) degs on the X_AXIS; and the same for the angle_between values for the other axis rotations.
The second clip shows the application of different series of rotations:
[flash=425,344:32q3oq38]http://www.youtube.com/v/TFAnDrHXaIg[/flash:32q3oq38]
Screenshots of rotations providing angle_between values of 90-90-90 shows there is either something fundamental missing or perhaps that an entirely different method is appropriate.
Any suggestions about this most welcome...
Chris
Advertisement