Difference between revisions of "For Tutorial 5"

From Progzoo
Jump to: navigation, search
(Less Regular Polygons)
(Less Regular Polygons)
 
Line 101: Line 101:
 
   Polygon reg = new Polygon();
 
   Polygon reg = new Polygon();
 
   int r;
 
   int r;
   int n = 6;
+
   int n = 16;
 
   for (int i=0;i<n;i++)
 
   for (int i=0;i<n;i++)
 
   {
 
   {

Latest 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]