Difference between revisions of "For Tutorial 5"

From Progzoo
Jump to: navigation, search
(Less Regular Polygons)
(Less Regular Polygons)
Line 105: Line 105:
 
   {
 
   {
 
     double a = i*2*Math.PI/n;
 
     double a = i*2*Math.PI/n;
     if (i==0 || i=2 || i==4)
+
     if (i==0 || i==2 || i==4)
 
       r=40;
 
       r=40;
 
     else
 
     else

Revision as of 13:53, 8 October 2012

Regular Polygon

You can find the coordinates of a regular polygon using sin and cosine.

Change n and r so that you get a hexagon that is twice the size.

Flaghexagon.png


[Font] [Default] [Show] [Resize] [History] [Profile]

Octagons

Draw the octogon 5 times to make the figure shown.

Flagoctagons.png


[Font] [Default] [Show] [Resize] [History] [Profile]


Less Regular Polygons

You can make a different kind of polygon by changing the radius at each step...

Make the radius different for different values of i.

Flag8Points.png


[Font] [Default] [Show] [Resize] [History] [Profile]