Notifications
Clear all
[Closed] Rotate object – math problem
May 07, 2014 9:38 pm
I’ve created this little script to visualize my problem:
delete objects
--plane
pl = plane pos:[0,0,0] width:20 length:10 wirecolor:yellow
spl = splineShape render_thickness:0.2 render_renderable:true render_displayRenderMesh:true wirecolor:blue
addnewSpline spl
addknot spl 1 #smooth #curve [0,0,0]
addknot spl 1 #smooth #curve [0,0,20]
updateShape spl
spl.parent = pl
rotate pl (random -30.0 30.0) X_Axis
rotate pl (random -30.0 30.0) Y_Axis
rotate pl (random -30.0 30.0) Z_Axis
pt = [random -30.0 30.0, random -30.0 30.0, random -30.0 30.0]
point pos:pt cross:false centerMarker:true wirecolor:green
spl2 = splineShape render_thickness:0.1 render_renderable:true render_displayRenderMesh:true wirecolor:green
addnewSpline spl2
addknot spl2 1 #smooth #curve [0,0,0]
addknot spl2 1 #smooth #curve pt
updateShape spl2
So it creates yellow plane (with it’s local Z axis as blue spline) and a random vector (green spline). My question is: how to rotate the yellow plane ABOUT IT’S LOCAL X AXIS to make it’s local Z orthogonal to the green vector?
1 Reply
May 07, 2014 9:38 pm
delete objects
--plane
pl = plane pos:[0,0,0] width:20 length:10 wirecolor:yellow
spl = splineShape render_thickness:0.2 render_renderable:true render_displayRenderMesh:true wirecolor:blue
addnewSpline spl
addknot spl 1 #smooth #curve [0,0,0]
addknot spl 1 #smooth #curve [0,0,20]
updateShape spl
spl.parent = pl
rotate pl (random -30.0 30.0) X_Axis
rotate pl (random -30.0 30.0) Y_Axis
rotate pl (random -30.0 30.0) Z_Axis
pt = [random -30.0 30.0, random -30.0 30.0, random -30.0 30.0]
point pos:pt cross:false centerMarker:true wirecolor:green
spl2 = splineShape render_thickness:0.1 render_renderable:true render_displayRenderMesh:true wirecolor:green
addnewSpline spl2
addknot spl2 1 #smooth #curve [0,0,0]
addknot spl2 1 #smooth #curve pt
updateShape spl2
pl.transform=matrixFromNormal (normalize (cross pl.transform.row1 pt))