public class Triangulator
extends java.lang.Object
Constructor and Description |
---|
Triangulator() |
Modifier and Type | Method and Description |
---|---|
static double |
area(Vector2D[] contour)
Calculate the area of the polygon.
|
static boolean |
isInsideTriangle(double aX,
double aY,
double bX,
double bY,
double cX,
double cY,
double pX,
double pY)
Determine if the point pX/pY is inside triangle defined by triangle ABC whose
vertices are given by [ax,ay] [bx,by] [cx,cy]
|
static boolean |
isInsideTriangle(Vector2D a,
Vector2D b,
Vector2D c,
double pX,
double pY)
Determine if the point (p) is inside triangle defined by triangle ABC
|
static boolean |
isInsideTriangle(Vector2D a,
Vector2D b,
Vector2D c,
Vector2D p)
Determine if the point (p) is inside triangle defined by triangle ABC
|
static java.lang.Integer[] |
triangulate(java.util.List<Vector2D> contour)
Create a set of triangles from a concave/convex polygon with no holes and no intersecting sides.
|
static boolean |
triangulate(java.util.List<Vector2D> contour,
java.util.List<java.lang.Integer> result)
Create a set of triangles from a concave/convex polygon with no holes and no intersecting sides.
|
static java.lang.Integer[] |
triangulate(Vector2D[] contour)
Create a set of triangles from a concave/convex polygon with no holes and no intersecting sides.
|
public static boolean triangulate(java.util.List<Vector2D> contour, java.util.List<java.lang.Integer> result)
contour
- an open list of vertices that make up a 2D polygonresult
- list of vertex indices (to contour list) in groups of three for the render trianglespublic static java.lang.Integer[] triangulate(java.util.List<Vector2D> contour)
contour
- an open list of vertices that make up a 2D polygonpublic static java.lang.Integer[] triangulate(Vector2D[] contour)
contour
- an array of vertices that make up an open 2D polygonpublic static double area(Vector2D[] contour)
contour
- an array of vertices that make up an open 2D polygonpublic static boolean isInsideTriangle(double aX, double aY, double bX, double bY, double cX, double cY, double pX, double pY)
public static boolean isInsideTriangle(Vector2D a, Vector2D b, Vector2D c, Vector2D p)
a
- triangle vertex 1b
- triangle vertex 2c
- triangle vertex 3p
- point of interestpublic static boolean isInsideTriangle(Vector2D a, Vector2D b, Vector2D c, double pX, double pY)
a
- triangle vertex 1b
- triangle vertex 2c
- triangle vertex 3pX
- x position for point of interestpY
- x position for point of interestProcessing library AI_for_2D_Games by Peter Lager. (C) 2013