Jump to content
  • Advertisement
Sign in to follow this  
utkarshseth

OpenGL constraining the motion of a line in a plane

This topic is 3940 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

Hi I want to constrain the movement(translation and rotation) of a line in a specific plane in opengl. How do i go about it ? I must also be able to move the plane around space but the line which is contained within must be constrained to the boundaries of the plane and must translate only in the region defined by the plane. Please help Utk

Share this post


Link to post
Share on other sites
Advertisement
For the first point you need to learn about planes, have a look here http://mathworld.wolfram.com/search/?query=plane&x=0&y=0

And for the 2nd point you can use glPushMatrix/glPopMatrix to save your matrix state and do hierarchical translations and rotations.

Share this post


Link to post
Share on other sites
You can define a co-ordinate frame, select one of its principle planes (e.g. the x-y plane) as the constraining plane, and formulate the box and point motions in 2D. Perhaps you can move both points individually, so that line translation and rotation are reduced to 2 translations. Especially then the restriction to the bounding box is easy. However, you have to define what happens on collision with the box. When rendering you have to complete the current co-ordinates of the points by the 3rd dimension (i.e. z==0 in the chosen case) and use them as local co-ordinates in the aforementioned co-ordinate frame.

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!