Download presentation
Presentation is loading. Please wait.
1
General 3D Rotation- rotation about an arbitrary axis Taken from Angel Interactive Computer Graphics with OpenGL (out of print) P2 P1 P0 Let vector u = p2-p1 Want unit vector v = u/|u| = [α x,α y,α z ] T
2
Transformation M=T(p0)R x (-θ x ) R y (- θ y ) R z (θ ) R y (θ y ) R x (θ x ) T(-p0) Lets look at v: Because |v| =1 α 2 x + α 2 y + α 2 z =1 We want to draw a line segment from origin to [α x,α y,α z ] T α x,α y,α z ΦxΦx ΦzΦz ΦyΦy There are three direction angles (the angles between v and the axes) Φ x, Φ y, Φ z We use these to find the direction cosines. cos Φ x = α x /1 cos Φ y = α y /1 cos Φ z = α z /1 Where cos 2 Φ x + cos 2 Φ y + cos 2 Φ z =1 We can compute θ x and θ y using these angles
3
Transformation αyαy α x,α y,α z αzαz 1 θxθx d θxθx Look at the projection of the line segment on the plane x=0 to see length of d on this plane We d is foreshortened to d=sqrt(α 2 y + α 2 z ) The angle of rotation is determined by the angle that the shadow makes on the z axis. However: the rotation matrix is determined by the sin and cos of θ x R x (θ x ) = | 1 0 0 0 | | 0 α z /d -α y /d 0 | | 0 α y /d α z /d 0 | | 0 0 01 |
4
Transformation 1 d θyθy R y is in a similar manner The angle of rotation is determined by the angle that the shadow makes on the z axis. However: the rotation matrix is determined by the sin and cos of θ x R y (θ y ) = | d/1 0 -α x /1 0 | | 0 1 0 0 | | α x /1 0 d/1 0 | | 0 0 01 | αxαx
5
Finally Remember to to a rotation around the z axis for the final angle θ M=T(p0)R x (-θ x ) R y (- θ y ) R z (θ ) R y (θ y ) R x (θ x ) T(-p0) Will generate the transformation matrix for an arbitrary rotation.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.