algorithmic modeling for Rhino
I figured it out:
you can find the transformation matrix by using:
rotMatrix = rs.XformChangeBasis (targetPlane, basePlane)
It is then possible to find the rotations using the equations below which are adapted from a c# component written by Daniel Piker (http://www.grasshopper3d.com/forum/topics/plane-rotations-x-y-z-a-b...) :
xRotation = math.degrees(math.atan2(rotMatrix[2,1], rotMatrix[2,2]));
yRotation = math.degrees(-math.atan2(rotMatrix[2,0], math.sqrt(rotMatrix[2,1] * rotMatrix[2,1] + rotMatrix[2,2] * rotMatrix[2,2])));
zRotation = math.degrees(math.atan2(rotMatrix[1,0], rotMatrix[0,0]));
print xRotation
print yRotation
print zRotation
I have attached a file with the definition
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by