org.vormplus.shapeLib.polygons
Class Pentagon

java.lang.Object
  extended by org.vormplus.shapeLib.BasicShape
      extended by org.vormplus.shapeLib.polygons.RegularPolygon
          extended by org.vormplus.shapeLib.polygons.Pentagon

public class Pentagon
extends RegularPolygon

Create a Pentagon object, a regular polygon with 5 sides. This class extends the BasicShape class. References ----------------- http://en.wikipedia.org/wiki/Pentagon http://www.mathopenref.com/pentagon.html

Author:
Jan Vantomme

Field Summary
 float radius
           
 processing.core.PVector[] vertices
           
 
Constructor Summary
Pentagon(processing.core.PApplet _p)
          Creates a Pentagon object with a radius of 50.
 
Method Summary
 float area()
          Returns the area of the Pentagon.
 float externalAngle()
          Returns the external angle of the Pentagon.
 float internalAngle()
          Returns the internal angle of the Pentagon.
 float perimeter()
          Returns the perimeter of the Pentagon.
 void render()
          Renders the Pentagon to the screen.
 Pentagon setRadius(float r)
          Sets the radius for the Pentagon.
 
Methods inherited from class org.vormplus.shapeLib.polygons.RegularPolygon
area, externalAngle, internalAngle, perimeter, render
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

radius

public float radius

vertices

public processing.core.PVector[] vertices
Constructor Detail

Pentagon

public Pentagon(processing.core.PApplet _p)
Creates a Pentagon object with a radius of 50.

Parameters:
_p - Reference to the PApplet object. Normally use 'this'
Method Detail

setRadius

public Pentagon setRadius(float r)
Sets the radius for the Pentagon.

Parameters:
r - Radius for the Pentagon.

render

public void render()
Renders the Pentagon to the screen.


area

public float area()
Returns the area of the Pentagon.

Returns:
float: Area of the Pentagon.

perimeter

public float perimeter()
Returns the perimeter of the Pentagon.

Returns:
float: Perimeter of the Pentagon.

internalAngle

public float internalAngle()
Returns the internal angle of the Pentagon.

Returns:
float: Internal angle of the Pentagon.

externalAngle

public float externalAngle()
Returns the external angle of the Pentagon.

Returns:
float: External angle of the Pentagon.