|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.eside.flingbox.math.PolygonUtils
public final class PolygonUtils
Implements some utilities for polygons.
Method Summary | |
---|---|
static Vector2D[] |
computePolygonNormals(Vector2D[] contour)
Computes the polygon's normals. |
static float |
distanceFromLineToPoint(Vector2D p0,
Vector2D p1,
Vector2D p)
Computes minimum distance from line to point |
static Vector2D[] |
douglasPeuckerReducer(Vector2D[] points,
float epsilon)
The Douglas-Peucker algorithm is an algorithm for reducing the number of points in a curve that is approximated by a series of points. |
static float |
polygonArea(Vector2D[] Vector2Ds)
Computes area of polygon. |
static Vector2D |
polygonCentroid(Vector2D[] contour)
Computes the polygon's centroid |
static boolean |
polygonConatinsPoint(Vector2D[] polygon,
Vector2D Vector2D)
Checks if a Vector2D is contained by a polygon. |
static short[] |
triangulatePolygon(Vector2D[] Vector2Ds)
Computes the triangulation of a polygon(tesellation) with ear-clipping algorithm. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Vector2D[] douglasPeuckerReducer(Vector2D[] points, float epsilon)
points
- Array of the polygon's pointsepsilon
- Max distance to ignore a point
public static short[] triangulatePolygon(Vector2D[] Vector2Ds)
Vector2Ds
- Array of polygon's points
public static boolean polygonConatinsPoint(Vector2D[] polygon, Vector2D Vector2D)
http://en.wikipedia.org/wiki/Winding_number
polygon
- polygon's Vector2DsVector2D
- Vector2D to be checkedpublic static float polygonArea(Vector2D[] Vector2Ds)
Vector2Ds
- Polygon's Vector2Ds
public static Vector2D polygonCentroid(Vector2D[] contour)
Vector2Ds
- Polygon's Vector2Ds
public static Vector2D[] computePolygonNormals(Vector2D[] contour)
contour
- Counterclockwise polygon points
public static float distanceFromLineToPoint(Vector2D p0, Vector2D p1, Vector2D p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |