rotation about an arbitrary point

Started by
2 comments, last by trunks14 14 years, 11 months ago
if a point rotates through 'theta' about the origin, how do i calculate through how much it has been rotated about an arbitrary point (rx, ry) ?
Advertisement
I'm not sure I understand the question but how about something like:
vOldVec  = Normalize(pOldPosition - pArbitraryPoint)vNewVec = Normalize(pNewPosition - pArbitraryPoint)fAngle = acos( DotProduct(vOldVec,vNewVec) )

Of course this doesn't give you a direction of rotation however I'm not even sure that even applies given the problem.
Quote:Original post by manu1001
if a point rotates through 'theta' about the origin, how do i calculate through how much it has been rotated about an arbitrary point (rx, ry) ?


It won't really work for an arbitary point. If you are just transforming a single point (which goes from it's original position a, to it's transformed position b), then only the points that lay on the line through the origin, and a point halfway points a and b, might be the center of a rotation that transform that partcular point from a to b, but as soon as you want to rotate multiple points using the same rotation, then it generally won't be possible to express that rotation as a rotation around any other point than the origin.

But I have the idea that you really are trying to do something else though, so maybe you could be a bit more specific on what you're trying to do?

[Edited by - quasar3d on May 2, 2009 7:52:59 PM]
You have to 'bring' the point about which you want the rotation to happen to the origin.
Then Apply the rotation and finally 'undo' your first translation.

In homogenous coordinates we would have:



Where:

(Px, Py) is the point to rotate about
(x, y) is the point you want transformed
theta is the angle of rotation
(Rx, Ry) is the rotated point

If you do the Matrix multiplications you will find a formula for Rx and Ry:




So, if I'm not wrong, the final formula to rotate about a point in 2-space would be:

This topic is closed to new replies.

Advertisement