View Full Version : Coordinates after rotation ?
I have a polygon that is displayed after a rotation. How do I find the new world-view coordinates of that polygon's points after it has been pushed through the rotation matrix?
Thanks a bunch,
11-06-2004, 04:44 AM
I saw your question on the OpenML message board!here's your responce:
for more information about the rotation, i suggest you to read the book *Interactive Computer Graphics by EDWARD ANGEL*.but in summery, i explain you that how this action is performmed.
if you rotate about the z axis by theta degrees, you can compute the new points with the following equations:
Newx = x * cos(theta) - y * sin(theta)
Newy = x * sin(theta) + y * cos(that)
Newz = z
or in matrix form
Pnew = Rz * P
where Rz is
|cos(theta) -sin(theta) 0 0|
|sin(theta) cos(theta) 0 0|
| 0 0 1 0|
| 0 0 0 1|
For rotation about the x axis, we have the following equations:
Newx = x
Newy = y * cos(theta) - z * sin( theta)
Newz = y * sin( theta) + z * cos(theta)
And for y rotation:
Newx = x * cos(theta) + z * sin(theta)
Newy = y
Newz = - x* sin(theta) + z * cos(theta)
Note that with these operations, the coordinate system also is rotated. it means that you actually are rotating both of these objects--polygon and coordinate system.if you use from another rotation before your rotation-because the OpenGL transformations are from down to top-you are changing the new changed coordinat system.
[ November 06, 2004: Message edited by: ehsan_kamrani ]
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.