Jump to content
  • Advertisement
Sign in to follow this  
Gumgo

Rotate point around line

This topic is 3630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If I have a line defined by two points, how do I rotate a point around that line by X degrees?

Share this post


Link to post
Share on other sites
Advertisement
In addition, you need to make a correction step, since the axis of the axis/angle rotation is defined to pass through [0 0 0]. Hence, choose any point on the line, e.g. one of the both directly given points, as temporary origin. If p1 and p2 are the 2 given points, then a transformation like
T(p1) * R(p2-p1,alpha) * T(-p1)
is suitable, where T denotes a translation matrix and R the rotation matrix as suggested by Mike nl. (Notice please that I've used column vectors (e.g. OpenGL) in the formula above; reverse the order if you use row vectors (e.g. D3D) instead.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!