Something about Constructing Angles

Started by
0 comments, last by mnansgar 18 years, 6 months ago
Hi there, I am just popped in here to ask a question, you know in school when you're constructing angles and stuff, let us say I am gonna construct a 45 degrees angle, then I first have to construct a 90 degree angle and bisect that or something right? Well, I wrote an application just now that just draw angles, you type in which angle you want and it draws it. But, the thing is, is there any way to mathematically find out which angles you need to construct before you actually reach the goal of, lets say 45 Degree angle. Hope I made myself clear, if not then I can give it another shot.
Those who help the really beginners asking for code getting a mind of their own, deserves a prize.We're all friends.
Advertisement
The methods you describe are geometrical ones which can be performed using a compass. The "mathematical" method you're asking about is called trigonometry.

Suppose that your starting point is some point (x0,y0) and that you have an angle theta. Now, you want to draw a line of length r from this point at theta degrees. The formula for this is:

x1 = r * cos(theta) + x0
y1 = r * sin(theta) + y0
DrawLine(x0,y0, x1,y1);

It's that easy! :-)
h20, member of WFG 0 A.D.

This topic is closed to new replies.

Advertisement