Shapes 3D  3.0
 All Classes Functions Variables Pages
shapes3d.utils.Triangulator Class Reference

Static Public Member Functions

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

Detailed Description

Based on source code found on the Internet and modified by the author to work directly with Processing. The URL for the original code has been lost).

Author
unknown, Peter Lager

Member Function Documentation

static double shapes3d.utils.Triangulator.area ( PVector[]  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
static int [] shapes3d.utils.Triangulator.asPrimatives ( Integer[]  array)
static

Converts Integer[] to int[]

Parameters
arrayof boxed integers i.e. Integer(s)
Returns
an array of integer primitives i.e. int(s)
static boolean shapes3d.utils.Triangulator.isInsideTriangle ( double  aX,
double  aY,
double  bX,
double  bY,
double  cX,
double  cY,
double  pX,
double  pY 
)
static

Decide if point pX/pY is inside triangle defined by triangle ABC

Parameters
aXvertex A : x value
aYvertex A : y value
bXvertex B : x value
bYvertex B : y value
cXvertex C : x value
cYvertex C : y value
pXx value to test
pYy value to test
Returns
true if inside else false
static boolean shapes3d.utils.Triangulator.isInsideTriangle ( PVector  a,
PVector  b,
PVector  c,
PVector  p 
)
static

Decide if point p is inside triangle defined by triangle ABC

Parameters
atriangle vertex
btriangle vertex
ctriangle vertex
pthe point to test
Returns
true if inside else false
static boolean shapes3d.utils.Triangulator.isInsideTriangle ( PVector  a,
PVector  b,
PVector  c,
double  pX,
double  pY 
)
static

Decide if point pX/pY is inside triangle defined by triangle ABC

Parameters
atriangle vertex
btriangle vertex
ctriangle vertex
pXx value to test
pYy value to test
Returns
true if inside else false
static boolean shapes3d.utils.Triangulator.triangulate ( List< PVector >  contour,
List< Integer >  result,
boolean  open 
)
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
opentrue if the contour is open, false if closed
resultlist of vertex indices (to contour list) in groups of three for the render triangles
Returns
true if succeeded else false
static Integer [] shapes3d.utils.Triangulator.triangulate ( List< PVector >  contour,
boolean  open 
)
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
opentrue if the contour is open, false if closed
Returns
list of vertex indices (to contour list) in groups of three for the render triangles
static Integer [] shapes3d.utils.Triangulator.triangulate ( PVector[]  contour,
boolean  open 
)
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
opentrue if the contour is open, false if closed
Returns
list 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: