# How do you draw a star?

We'll place a star in the center of a circle that has a radius of 200. Our star has 5 outer points and 5 inner points. Each of these points can be calculated from a line segment that extends from the center of the star to the point.This line segment has a length and an angle and we use this to calculate the X and Y values of the points.

The line segments to the outer points are all 200 in length and the angles are 72° (or 360°/5) apart.

# First find the top point

We start with the top point at 90° and use polar to rectangular conversion to calculate X and Y.X = Xcenter + cos(angle)*length_of_segment

Y = Ycenter - sin(angle)*length_of_segment

For 90°, it boils down to this:

X = 200 + cos(90)*200

Y = 200 - sin(90)*200

# Now find the second point

The next outer point is 72° further along at 162°.For 162°, these equations apply:

X = 200 + cos(162)*200

Y = 200 - sin(162)*200

# The third point

The next outer point is 72° further along at 234°.For 234°, these equations apply:

X = 200 + cos(234)*200

Y = 200 - sin(234)*200

# The fourth point

The next outer point is 72° further along at 306°.For 306°, these equations apply:

X = 200 + cos(306)*200

Y = 200 - sin(306)*200

# The last outer point

The next outer point is 72° further along at 18°.For 18°, these equations apply:

X = 200 + cos(18)*200

Y = 200 - sin(18)*200

Now we have located all of the outer points. Those were easy. Now on to the inner points!

# Now find the inner points

We know that these formulas are used to calculate X and Y:X = Xcenter + cos(angle)*length_of_segment

Y = Ycenter - sin(angle)*length_of_segment

The next inner point is 36° (72°/2) further along at 54°.

But, how do we find the length of the red line segment?

# Finding the length of the inner segment

We start with the right triangle whose hypotenuse is the segment from the last outer spoke. We know that this segment is at an angle of 18°. Therefore, angle α is 72° (90° - 18°).This means that angle β is 18°.

How does that help, you ask? Read on...

# Find the coordinates of the inner point

We then use the right triangle formed by bisecting the isosceles triangle that is one of the "arms" of the star. We know from before that angle β is 18°. Therefore angle θ is our old friend, 72°.We also know that the Y coordinate of the point we seek is the same as the Y coordinate of the outer point at the tip of the red triangle.

If we can find the length of the base of the red triangle, we can calculate the X coordinate by means to be revealed later.

# Find the length of segment A

The length of the segment A found by multiplying the length of the opposite side by the ratio of the adjacent side to the opposite side.In other words:

A = O * (A/O)

Using trigonometry, we know that:

A = O * cot(72°)

But how do we get the value for O?

# Find the length of segment O

Now we apply what we learned to the top arm of the triangle.Here, it's easy to see that the length of segment O is simply the length of an outer spoke (we know this to be 200) minus the Y value we arrived at earlier.

In other words:

O = 200-Y

Now we substitute this into the previous equation:

A = (200-Y) * cot(72°)

# Find the length of the inner spoke

Now we know that:X = 200 - A

We also know from before that Y is found by:

Y = 200 - (200 * sin(18°))

And finally, by using the distance formula, we can convert back to polar to get the long sought-after length of the inner spoke.

L = sqrt(X^2 + Y^2)

# Now find the inner points

This inner point is at 126°.For 126°, these equations apply:

X = 200 + cos(126)*76.39320225002105

Y = 200 - sin(126)*76.39320225002105

# The second inner point

The next inner point is 72° further along at 198°.For 198°, these equations apply:

X = 200 + cos(198)*76.39320225002105

Y = 200 - sin(198)*76.39320225002105

# The third inner point

The next inner point is 72° further along at 270°.For 270°, these equations apply:

X = 200 + cos(270)*76.39320225002105

Y = 200 - sin(270)*76.39320225002105

# The fourth inner point

The next inner point is 72° further along at 342°.For 342°, these equations apply:

X = 200 + cos(342)*76.39320225002105

Y = 200 - sin(342)*76.39320225002105

# The last inner point

The last inner point is 72° further along at 54°.For 54°, these equations apply:

X = 200 + cos(54)*76.39320225002105

Y = 200 - sin(54)*76.39320225002105