Saturday, April 1, 2017

Polygon Pi

   As the number of sides of a regular polygon inscribed in a circle increases, the polygon gets closer and closer to the shape of a circle. This fact is widely used in video games because the human eye will accept a shape as being a circle even when the number of sides in the regular polygon is as small as 20. The wheels of a car in a video game can be rendered as 20-sided polygons. 
   The sum of the lengths of the sides in any regular polygon is called its perimeter.
   A regular polygon of n sides with side length p has a Perimeter
P = np units.
   As you know, the perimeter of a circle is called its circumference.
The ratio of the circumference to the diameter of any circle is that famous, irrational number, Pi.
π = C/D
   One could gain an approximation for Pi by measuring the circumference and diameter of a circle to as high a degree of accuracy as current measurement technology allows and then evaluate the ratio of circumference to diameter. But mathematics and access to Scratch give us an easier and cheaper (no need to buy expensive measuring tools) way to evaluate Pi.
   We need to determine the relationship between the number of sides in a regular polygon, its radius, and the central angle subtended by one of its sides.
   For any regular polygon, we would like to know how to compute the length of one of the equal sides given the radius of the circumscribed circle.
   Consider the seven-sided regular polygon (heptagon or septagon) shown in the figure below.
   The central angle in any regular polygon of n sides can be computed by dividing 360º by n
central angle = 360º/n
   Construct the line from the center of a regular polygon at right angles to any of its sides. This line is called the apothem.
   The hypotenuse–leg theorem states that any two right triangles that have a congruent hypotenuse and a corresponding, congruent leg, are congruent triangles. Therefore, the apothem bisects the central angle.
   Let s equal the length of a side in a regular polygon and ø the angle between the apothem and the radius as shown in the following diagram.
   Then ø = half the central angle. This gives ø in terms of n, the number of sides.
ø = 360º/2n
ø = 180/n   [Equation 1.]

   In the right triangle,  sing = (s/2)/r and solving for s
s=2r(sin(ø)   [Equation 2.]
   Substitute Equation 1 for ø in Equation 2.
s=2rsin(180/n)  [Equation 3.]
   The perimeter is P = ns or 
P=n2rsin(180/n)   [Equation 4.]
   The ratio of the perimeter of the polygon to 2r gives an approximation to Pi.
   Given a radius of 100 units, Equation 3 and the approximation to Pi is coded in the following, short, Scratch script.
   The Scratch program was run to generate the data in the following table.
   A polygon with just 12 sides and a radius of 100 approximates the first two digits of Pi, 3.1.
   Equation 3 with r = 100 units can be used to write a Scratch script that draws the polygon for any given number of sides.
   I leave it to you to key in the above code and verify that is does indeed draw the regular polygon specified by the number of sides variable.

1 comment:

  1. i have been scratching my head to solve the problem but sadly nothing came to the aid. but now that i got to this post i cant thank you enough for this.