Class Geometer

java.lang.Object
  extended byTurtle
      extended byGeometer

public class Geometer
extends Turtle

The Geometer class is a turtle that is able to perform many tasks that involve looping behavior. You can choose which methods to implement. In all methods, unless otherwise noted, turns should be right turns, and you should move before you turn. Each method should also put the pen down at the start and pick it up when finished.

See Also:
Serialized Form

Constructor Summary
Geometer()
           
 
Method Summary
 void asterisk(int points, double length)
          Draw a set of lines all radiating out from one point, each of the length given.
 void asterisks(int points, double length)
          Draw a sequence of asterisks, starting with the given number of points and length.
 void doubleStacks(int boxes)
          Draw a stack with the given number of boxes, then smaller stacks trailing off to both sides.
 void polygon(int sides)
          Draw a polygon with the specified number of sides, each side one long.
 void polygons(int sides)
          Draw a series of polygons, from a triangle up to the number of sides given.
 void stack(int boxes)
          Draw a stack of squares, starting where the Geometer is now and returning to that spot.
 void stacks(int boxes)
          Draw a sequaence of stacks, starting with the given size and trailing off to the right, making stacks each one smaller than the last until you get to an empty stack.
 void star(int points, double angle)
          Draw a star with the given number of points, where the interior angle of each point is the angle given.
 void stars(int points, double angle)
          Draw a sequence of stars, all with the same angle, but varying in their number of points, from two points up to the number given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Geometer

public Geometer()
Method Detail

asterisk

public void asterisk(int points,
                     double length)
Draw a set of lines all radiating out from one point, each of the length given.

Parameters:
points - Number of lines to draw
length - Length of each line

asterisks

public void asterisks(int points,
                      double length)
Draw a sequence of asterisks, starting with the given number of points and length. Each subsequent asterisk should have one fewer points, have a length 4/5 of the previous asterisk's, and be that length away from the previous asterisk. You may choose to make the opacity also decrease by a factor of 9/10 with each new asterisk. It may be somewhat tricky, in this one, to make sure you return to where you started.

Parameters:
points - Number of points of largest asterisk
length - Length of largest asterisk

doubleStacks

public void doubleStacks(int boxes)
Draw a stack with the given number of boxes, then smaller stacks trailing off to both sides.

Parameters:
boxes - Number of boxes in largest stack.

polygon

public void polygon(int sides)
Draw a polygon with the specified number of sides, each side one long.

Parameters:
sides - Number of sides.

polygons

public void polygons(int sides)
Draw a series of polygons, from a triangle up to the number of sides given. All of them should share one side, which is the side the Geometer starts (and ends) facing along.

Parameters:
sides - Number of sides of largest polygon.

stack

public void stack(int boxes)
Draw a stack of squares, starting where the Geometer is now and returning to that spot.

Parameters:
boxes - Number of boxes in the stack.

stacks

public void stacks(int boxes)
Draw a sequaence of stacks, starting with the given size and trailing off to the right, making stacks each one smaller than the last until you get to an empty stack. Be sure to return to your start position.

Parameters:
boxes - Number of boxes in the largest stack.

star

public void star(int points,
                 double angle)
Draw a star with the given number of points, where the interior angle of each point is the angle given. The star should start with a move that brings you to a point, then a right turn around that point.

Parameters:
points - Number of points
angle - Interior angle of each point.

stars

public void stars(int points,
                  double angle)
Draw a sequence of stars, all with the same angle, but varying in their number of points, from two points up to the number given. They should all share the first point drawn.

Parameters:
points - Number of points of largest star
angle - Interior angle of all points