AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.maths.Triangulator Class Reference

Static Public Member Functions

static boolean triangulate (List< Vector2D > contour, List< Integer > result)
 
static Integer[] triangulate (List< Vector2D > contour)
 
static Integer[] triangulate (Vector2D[] contour)
 
static double area (Vector2D[] contour)
 
static boolean isInsideTriangle (double aX, double aY, double bX, double bY, double cX, double cY, double pX, double pY)
 
static boolean isInsideTriangle (Vector2D a, Vector2D b, Vector2D c, Vector2D p)
 
static boolean isInsideTriangle (Vector2D a, Vector2D b, Vector2D c, double pX, double pY)
 

Static Package Attributes

static final double EPSILON = 1E-30
 

Static Private Member Functions

static boolean snip (Vector2D[] contour, int u, int v, int w, int n, int[] vList)
 

Detailed Description

Various routines to work with concave/convex shapes.

Author
Peter Lager

Member Function Documentation

◆ area()

static double game2dai.maths.Triangulator.area ( Vector2D[]  contour)
static

Calculate the area of the polygon.

Parameters
contouran array of vertices that make up an open 2D polygon
Returns
the area of the polygon

◆ isInsideTriangle() [1/3]

static boolean game2dai.maths.Triangulator.isInsideTriangle ( double  aX,
double  aY,
double  bX,
double  bY,
double  cX,
double  cY,
double  pX,
double  pY 
)
static

Determine if the point pX/pY is inside triangle defined by triangle ABC whose vertices are given by [ax,ay] [bx,by] [cx,cy]

Returns
true if the point is inside

◆ isInsideTriangle() [2/3]

static boolean game2dai.maths.Triangulator.isInsideTriangle ( Vector2D  a,
Vector2D  b,
Vector2D  c,
double  pX,
double  pY 
)
static

Determine if the point (p) is inside triangle defined by triangle ABC

Parameters
atriangle vertex 1
btriangle vertex 2
ctriangle vertex 3
pXx position for point of interest
pYx position for point of interest
Returns
true if inside triangle else false

◆ isInsideTriangle() [3/3]

static boolean game2dai.maths.Triangulator.isInsideTriangle ( Vector2D  a,
Vector2D  b,
Vector2D  c,
Vector2D  p 
)
static

Determine if the point (p) is inside triangle defined by triangle ABC

Parameters
atriangle vertex 1
btriangle vertex 2
ctriangle vertex 3
ppoint of interest
Returns
true if inside triangle else false

◆ triangulate() [1/3]

static Integer[] game2dai.maths.Triangulator.triangulate ( List< Vector2D contour)
static

Create a set of triangles from a concave/convex polygon with no holes and no intersecting sides.

Parameters
contouran open list of vertices that make up a 2D polygon
Returns
an array of vertex indices (to contour list) in groups of three for the render triangles

◆ triangulate() [2/3]

static boolean game2dai.maths.Triangulator.triangulate ( List< Vector2D contour,
List< Integer >  result 
)
static

Create a set of triangles from a concave/convex polygon with no holes and no intersecting sides.

Parameters
contouran open list of vertices that make up a 2D polygon
resultlist of vertex indices (to contour list) in groups of three for the render triangles
Returns
true if succeeded else false

◆ triangulate() [3/3]

static Integer[] game2dai.maths.Triangulator.triangulate ( Vector2D[]  contour)
static

Create a set of triangles from a concave/convex polygon with no holes and no intersecting sides.

Parameters
contouran array of vertices that make up an open 2D polygon
Returns
an array of vertex indices (to contour list) in groups of three for the render triangles

The documentation for this class was generated from the following file: