org.vormplus.shapeLib.polygons
Class Hexagon

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

public class Hexagon
extends RegularPolygon

Creates a Hexagon object, a regular polygon with 6 sides. This class extends the BasicShape class. References ----------------- http://en.wikipedia.org/wiki/Hexagon http://www.mathopenref.com/hexagon.html

Author:
Jan Vantomme

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

Hexagon

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

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

setRadius

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

Parameters:
r - Radius for the Hexagon.

render

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


area

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

Returns:
float: Area of the Hexagon.

perimeter

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

Returns:
float: Perimeter of the Hexagon.

internalAngle

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

Returns:
float: Internal angle of the Hexagon.

externalAngle

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

Returns:
float: External angle of the Hexagon.