|
|
|
|
#1 |
|
Junior Member
|
Here's what I use for 3D rotation:
x2=x1*cos(a1)+y1*sin(a1); y2=-x1*sin(a1)+y1*cos(a1); x3=x2*cos(a2)+z1*sin(a2); z2=-x2*sin(a2)+z1*cos(a2); y3=y2*cos(a3)+z2*sin(a3); z3=-y2*sin(a3)+z2*cos(a3); x1,y1,z1 are the coordinates of the object. x3,y3,z3 are the final coordinates of the rotated object x2,y2,z2 are just temporary a1,a2,a3 are the three angles of rotation (xoy, xoz, yoz) Is there any better way to do this? Basically I am using 3 diffrent planar rotations, I couldn't find any good formulas for a 3D rotation. Also, this is what I use for 3D transformation, and I think it's the best way, because besides zoom, it's got perspective correction. x=((x3*z0)/(z0-z3))/(z0-1); y=((y3*z0)/(z0-z3))/(z0-1); x3,y3,z3 are the object coordinates, z0 is the zoom. If anyone got an optimisation for this... I'd gladly use it. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|