Transformation.to_a array definition
-
Sorry if I have missed it in the API documentation but could someone point me to where the definition is for each of the 16-elements in the transformation array created by Transformation.to_a (http://code.google.com/apis/sketchup/docs/ourdoc/transformation.html)? I have discovered elements 12,13,14 => x,y,z and was hoping to get the rest without trial and error.
Thanks for your help.
-
As far as I know the 16 things aren't [well] documented...
-
Pity - maybe Jim can help?
What I really need for now is to determine the unit vectors for the local axis of a group or component instance entity. Anyone know if this is in the transformation array or of an easier way?
-
the 16 unit array is a 4 by 4 grid of numbers. There are resources on the internet that begin to explain hot to work with it directly. So far I've gotten around it for the most part by using methods offered in the API.
To get the unit vectors for a componentinstance (or group), use this
comp_x_axis = component_instance.transformation.xaxis comp_y_axis = component_instance.transformation.yaxis comp_z_axis = component_instance.transformation.zaxis
That will return a unitvector for each axis of the group or component.
Hope that helps,
Chris
-
Thank you!
-
not having looked at it much myself i cant say for sure, but its likely the numbers are the elements of a 4x4 transformation matrix.
Lots of info through google: http://www.google.co.uk/search?rlz=1C1CHMG_enGB291GB303&sourceid=chrome&ie=UTF-8&q=4x4+matrix+transformation although it can be a bit tricky to wrap your head around if you havent done much matrices stuff before.
-
Some years ago I wrote a plugin shader for MentalRay that uses the transformation matrix for different modifications like translation, rotation, scale, shear, rotation order, rotation axis, rotation pivot and scale pivot.
If you're interested in looking at the source code for it (C++) to see "what does what" you can find it here: http://www.pixero.com/files/JS_Place3dTexture.zip -
Thanks guys. My math is so rusty that I did not realize that a 4x4 transformation matrix had a "standard" mathematical definition.
-
Don't worry, nether did I. I found it on Wikipedia, but the math involved is a bit over my head for the time being. But in time I hope to get it figured out. Glad you got it working though,
Chris
Advertisement