Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Yel

drawLine with angle and length

This topic is 5914 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 all ! can anybody tell me if there is a direct method in openGL to draw a line using a starting point and an angle the length ?? all hints are very much appreciated Yel

Share this post


Link to post
Share on other sites
Advertisement
I think, there is no method to draw lines with angle and length... Maybe some of the support libraries (glu, glaux, glut) does that.
You can calculate in on your self, so you get two points.

PM

Share this post


Link to post
Share on other sites
Make your own function:

This is what you got:

X1 = 15
Y1 = 30
Angle = 1.23 <-- in radians (360 degrees = 2*PI radians)
Length = 50


Then calculate what you need:

X2 = X1 + Length * cos(Angle)
Y2 = Y1 + Length * sin(Angle)


Now draw a line between (X1, Y1) and (X2, Y2).

Share this post


Link to post
Share on other sites

  • 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!