Transformation.to_a array definition

Transformation.to_a array definition

Postby amanzi » Wed May 20, 2009 7:37 pm

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/do ... ation.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.
0

amanzi 
 

Re: Transformation.to_a array definition

Postby TIG » Wed May 20, 2009 8:52 pm

As far as I know the 16 things aren't [well] documented...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: Transformation.to_a array definition

Postby amanzi » Wed May 20, 2009 9:18 pm

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?
0

amanzi 
 

Re: Transformation.to_a array definition

Postby Chris Fullmer » Wed May 20, 2009 10:05 pm

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
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: Transformation.to_a array definition

Postby amanzi » Wed May 20, 2009 10:24 pm

Thank you!
0

amanzi 
 

Re: Transformation.to_a array definition

Postby remus » Wed May 20, 2009 11:04 pm

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=1C1C ... sformation although it can be a bit tricky to wrap your head around if you havent done much matrices stuff before.
0

remus 
 

Re: Transformation.to_a array definition

Postby Pixero » Thu May 21, 2009 5:59 pm

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
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: Transformation.to_a array definition

Postby amanzi » Thu May 21, 2009 6:44 pm

Thanks guys. My math is so rusty that I did not realize that a 4x4 transformation matrix had a "standard" mathematical definition.
0

amanzi 
 

Re: Transformation.to_a array definition

Postby Chris Fullmer » Fri May 22, 2009 5:35 am

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
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: lutus and 3 guests

Visit our sponsors: