Package nl.colorize.multimedialib.math
Class Polygon
- java.lang.Object
-
- nl.colorize.multimedialib.math.Polygon
-
-
Constructor Summary
Constructors Constructor Description Polygon(float... points)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Point2D p)static PolygoncreateCircle(Point2D origin, float radius, int numPoints)Convenience method to create a polygon in the shape of a circle with the specified properties.static PolygoncreateCone(Point2D origin, float startAngle, float arc, float length)Convenience method to create a polygon in the shape of a circle with the specified properties.booleanequals(java.lang.Object o)intgetNumPoints()float[]getPoints()floatgetPointX(int n)floatgetPointY(int n)inthashCode()booleanintersects(Polygon p)Returns true if this polygon intersects with the specified other polygon.voidmove(float dx, float dy)voidsetPoints(float... points)java.lang.StringtoString()
-
-
-
Method Detail
-
setPoints
public void setPoints(float... points)
-
getPoints
public float[] getPoints()
-
getNumPoints
public int getNumPoints()
-
getPointX
public float getPointX(int n)
-
getPointY
public float getPointY(int n)
-
move
public void move(float dx, float dy)
-
intersects
public boolean intersects(Polygon p)
Returns true if this polygon intersects with the specified other polygon. Implementation based on http://slick.cokeandcode.com.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
createCircle
public static Polygon createCircle(Point2D origin, float radius, int numPoints)
Convenience method to create a polygon in the shape of a circle with the specified properties.
-
-