drawLine with angle and length
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
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
You can calculate in on your self, so you get two points.
PM
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).
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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement