jurpe.dungeon.crawler
Class Hexagon

java.lang.Object
  extended by java.awt.Polygon
      extended by jurpe.dungeon.crawler.Hexagon
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable

public class Hexagon
extends java.awt.Polygon

A hexagon.

Author:
Antti Kerminen, Alessio Saltarin
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Polygon
npoints, xpoints, ypoints
 
Constructor Summary
Hexagon(int x, int y, int w, int h)
          Create a new hexagon.
Hexagon(java.awt.Point center, int w, int h)
          Create a new hexagon.
 
Method Summary
 java.awt.Point getCenter()
           
 int[] getSide(Direction dir)
          Get the coordinates of 1 side of hexagon
 double height()
          Get the height.
static void main(java.lang.String[] args)
           
 double radius()
          Get radius
 java.lang.String toString()
          Return to string pepresentation of this object.
 int width()
          Get the width.
 
Methods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Hexagon

public Hexagon(int x,
               int y,
               int w,
               int h)
Create a new hexagon.

Parameters:
x - the x coordinate of the center point.
y - the y coordinate of the center point.
w - width of the hexagon.
h - height of the hexagon.

Hexagon

public Hexagon(java.awt.Point center,
               int w,
               int h)
Create a new hexagon.

Parameters:
center - the center point.
w - width of the hexagon.
h - height of the hexagon.
Method Detail

getCenter

public java.awt.Point getCenter()
Returns:

getSide

public int[] getSide(Direction dir)
Get the coordinates of 1 side of hexagon

Parameters:
dir - Direction from the center
Returns:
Coordinates of line in the form (x1,y1-x2,y2)

height

public double height()
Get the height.


width

public int width()
Get the width.


radius

public double radius()
Get radius

Returns:
radius

toString

public java.lang.String toString()
Return to string pepresentation of this object.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net