I remember the class asking my high school geometry teacher, “Why do we need to know about sines and cosines? How will we use this in real life?” He didn’t give us much of an answer, and at least in my life the answer was that I didn’t need trigonometry, not until now. I finally figured out what it’s good for in my life.
I’m looking at the Maine state legislature and would like my computer to put icons for each member of a legislative committee on a circle, equidistant from one another. Why? Well, later on, I intend to draw lines between the members’ icons in order to express something about the relationships between them. But for now my problem is to get a nice, neat circle of dots, each representing a legislator. For committees with size X, the dots should be placed (360/X) degrees away from one another on the circle. For a committee of 12 people, then, there should be dots placed at 0 degrees, 30 degrees, 60 degrees, 90 degrees, 120 degrees … and so on, all around the circle.
That’s all well and good, but what are the x,y coordinates for a point 30 degrees along in a circle? Trig!
The center point of a circle and a point along the edge of a circle mark two points of a right triangle; the third point in the example to our left forms a right angle along the horizontal axis of the circle.
For an image of width W and height H, the center point of the circle will be (W/2),(H/2). The radius r of the circle is W/2, and it is also the hypotenuse of the right triangle. The location to place our dot on the edge of the circle will be (W/2)+b,(H/2)-a. We can set the values of the width W and height H of the image. All we need to do is figure out the values of a and b for angle A. Those values are
a = r * Sin(A)
b = r * Cos(A)
What’s A? It’s whatever we want it to be. To find a series of 12 dots for 12 legislators, we can draw a series of right triangles all the way around the circle, each anchored at the circle’s center point and at the edge of the circle, with angles in increasing increments of 30 degrees. For each triangle, we can use the sine and cosine of A to find out how where to place our dots.
Here’s the Maine state legislature’s Appropriations Committee, drawn by a computer using the GD graphics commands in the language PHP. Republicans are pinkish, Democrats are bluish.

This process can be used for any number of dots representing any number of committee members.
There’s how I’ll use trigonometry in real life, Mr. Sobieraski.
Recent Comments