# Drawing a line at a certain angle

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

## Recommended Posts

I can do it, but not :3 I used that thing in my head called a brain to do this: (Language = lua)
Line = { x = 400, y = 300, x_2 = 0, y_2 = 0, Length = 100 }
Angle = 90
Line.x_2 = Line.x + math.cos(Angle)*Line.Length
Line.y_2 = Line.y + math.sin(Angle)*Line.Length


BUT it's not coming out at angle I've put in. This is with angle set to 90 (The straight line is at 0 degrees - the other was drew using method above): I don't just want to have the line at 90 degress, otherwise I would of just drew normally. Sorry if this is an obvious question :3

##### Share on other sites
How do I convert degress to radians? I haven't done radians in school yet, I'm only 14 :/

I figured out after posting this that I had to make the degrees into 0.0-1.0, is that radians?

What do I put for the radians bit?

Luckily lua has a deg to radians and vica versa function, but I would still like to know how to convert them.

Also, Thank you Sneftel

[Edited by - MrPickle on July 14, 2008 11:26:24 AM]

##### Share on other sites
0 == 0 degrees
PI == 180 degrees
2x PI == 360 degrees

##### Share on other sites
Quote:
 Original post by MrPickleHow do I convert degress to radians? Luckily lua has a deg to radians and vica versa function, but I would still like to know how to convert them.

To convert degrees to radians: degrees * pi / 180

Thank you :)

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
18
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632589
• Total Posts
3007241

×