org.vormplus.shapeLib.polygons
Class Octagon

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

public class Octagon
extends RegularPolygon

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

Author:
Jan Vantomme

Field Summary
 float radius
           
 processing.core.PVector[] vertices
           
 
Constructor Summary
Octagon(processing.core.PApplet _p)
          Creates a Octagon object with a radius of 50.
 
Method Summary
 float area()
          Returns the area of the Octagon.
 float externalAngle()
          Returns the external angle of the Octagon.
 float internalAngle()
          Returns the internal angle of the Octagon.
 float perimeter()
          Returns the perimeter of the Octagon.
 void render()
          Renders the Octagon to the screen.
 Octagon setRadius(float r)
          Sets the radius for the Octagon.
 
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

Octagon

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

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

setRadius

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

Parameters:
r - Radius for the Octagon.

render

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


area

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

Returns:
float: Area of the Octagon.

perimeter

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

Returns:
float: Perimeter of the Octagon.

internalAngle

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

Returns:
float: Internal angle of the Octagon.

externalAngle

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

Returns:
float: External angle of the Octagon.