HE_Mesh  5.1.2
wblut.geom.WB_PolygonTriangulatorJTS Class Reference

Classes

class  EdgeFlipper
 
class  IndexedDouble
 
class  IndexedDoubleComparator
 
class  IndexedEnvelope
 
class  IndexedEnvelopeComparator
 
class  IndexedTriangle
 

Public Member Functions

 WB_PolygonTriangulatorJTS ()
 
WB_Triangulation2D triangulatePolygon2D (final WB_Polygon polygon, final boolean optimize)
 
WB_Triangulation2DWithPoints triangulatePolygon2D (final List<?extends WB_Coord > outerPolygon, final List<?extends WB_Coord >[] innerPolygons, final boolean optimize, final WB_Map2D context)
 
WB_Triangulation2DWithPoints triangulatePolygon2D (final int[] polygon, final WB_Coord[] points, final boolean optimize, final WB_Map2D context)
 
WB_Triangulation2D triangulatePolygon2D (final int[] polygon, final List<?extends WB_Coord > points, final boolean optimize, final WB_Map2D context)
 
int[] triangulateFace (final HE_Face face, final boolean optimize)
 
int[] triangulateSimplePolygon (final WB_Polygon polygon, final boolean optimize)
 

Static Public Member Functions

static int[] triangulateQuad (final WB_Coord p0, final WB_Coord p1, final WB_Coord p2, final WB_Coord p3)
 
static void main (final String[] args)
 

Protected Member Functions

WB_Polygon makeSimplePolygon (final WB_Polygon polygon)
 
void createShell (final Polygon inputPolygon)
 

Private Member Functions

int[] triangulate (final Polygon inputPolygon, final boolean improve)
 
boolean isValidEdge (final int index0, final int index1)
 
int nextShellCoord (final int pos)
 
void doImprove (final List< IndexedTriangle > earList)
 
void joinHoleToShell (final Polygon inputPolygon, final Geometry hole)
 
void doJoinHole (final int shellVertexIndex, final Coordinate[] holeCoords, final int holeVertexIndex)
 

Static Private Member Functions

static int[] extractEdgesTri (final int[] ears)
 
static long getIndex (final int i, final int j, final int f)
 
static List< Geometry > getOrderedHoles (final Polygon poly)
 
static int getLowestVertex (final Geometry geom)
 

Private Attributes

final WB_GeometryFactory geometryfactory = new WB_GeometryFactory()
 
List< Coordinate > shellCoords
 
boolean[] shellCoordAvailable
 

Constructor & Destructor Documentation

wblut.geom.WB_PolygonTriangulatorJTS.WB_PolygonTriangulatorJTS ( )

Member Function Documentation

void wblut.geom.WB_PolygonTriangulatorJTS.createShell ( final Polygon  inputPolygon)
protected

Transforms the input polygon into a single, possible self-intersecting shell by connecting holes to the exterior ring, The holes are added from the lowest upwards. As the resulting shell develops, a hole might be added to what was originally another hole.

Parameters
inputPolygon
void wblut.geom.WB_PolygonTriangulatorJTS.doImprove ( final List< IndexedTriangle >  earList)
private

Attempts to improve the triangulation by examining pairs of triangles with a common edge, forming a quadrilateral, and testing if swapping the diagonal of this quadrilateral would produce two new triangles with larger minimum interior angles.

Parameters
earList
void wblut.geom.WB_PolygonTriangulatorJTS.doJoinHole ( final int  shellVertexIndex,
final Coordinate[]  holeCoords,
final int  holeVertexIndex 
)
private

Helper method for joinHoleToShell. Insert the hole coordinates into the shell coordinate list.

Parameters
shellVertexIndexinsertion point in the shell coordinate list
holeCoordsarray of hole coordinates
holeVertexIndexattachment point of hole
static int [] wblut.geom.WB_PolygonTriangulatorJTS.extractEdgesTri ( final int[]  ears)
staticprivate
Parameters
ears
Returns
static long wblut.geom.WB_PolygonTriangulatorJTS.getIndex ( final int  i,
final int  j,
final int  f 
)
staticprivate
Parameters
i
j
f
Returns
static int wblut.geom.WB_PolygonTriangulatorJTS.getLowestVertex ( final Geometry  geom)
staticprivate

Return the index of the lowest vertex.

Parameters
geominput geometry
Returns
index of the first vertex found at lowest point of the geometry
static List<Geometry> wblut.geom.WB_PolygonTriangulatorJTS.getOrderedHoles ( final Polygon  poly)
staticprivate

Returns a list of holes in the input polygon (if any) ordered by y coordinate with ties broken using x coordinate.

Parameters
polyinput polygon
Returns
a list of Geometry objects representing the ordered holes (may be empty)
boolean wblut.geom.WB_PolygonTriangulatorJTS.isValidEdge ( final int  index0,
final int  index1 
)
private

Check if a candidate edge between two vertices passes through any other available vertices.

Parameters
index0first vertex
index1second vertex
Returns
true if the edge does not pass through any other available vertices; false otherwise
void wblut.geom.WB_PolygonTriangulatorJTS.joinHoleToShell ( final Polygon  inputPolygon,
final Geometry  hole 
)
private

Join a given hole to the current shell. The hole coordinates are inserted into the list of shell coordinates.

Parameters
inputPolygon
holethe hole to join
static void wblut.geom.WB_PolygonTriangulatorJTS.main ( final String[]  args)
static
WB_Polygon wblut.geom.WB_PolygonTriangulatorJTS.makeSimplePolygon ( final WB_Polygon  polygon)
protected
Parameters
polygon
Returns
int wblut.geom.WB_PolygonTriangulatorJTS.nextShellCoord ( final int  pos)
private

Get the index of the next available shell coordinate starting from the given candidate position.

Parameters
poscandidate position
Returns
index of the next available shell coordinate
int [] wblut.geom.WB_PolygonTriangulatorJTS.triangulate ( final Polygon  inputPolygon,
final boolean  improve 
)
private

Perform the triangulation.

Parameters
inputPolygon
improveif true, improvement of the triangulation is attempted as a post-processing step
Returns
GeometryCollection of triangular polygons
int [] wblut.geom.WB_PolygonTriangulatorJTS.triangulateFace ( final HE_Face  face,
final boolean  optimize 
)
WB_Triangulation2D wblut.geom.WB_PolygonTriangulatorJTS.triangulatePolygon2D ( final WB_Polygon  polygon,
final boolean  optimize 
)
Parameters
polygon
optimize
Returns
WB_Triangulation2DWithPoints wblut.geom.WB_PolygonTriangulatorJTS.triangulatePolygon2D ( final List<?extends WB_Coord outerPolygon,
final List<?extends WB_Coord >[]  innerPolygons,
final boolean  optimize,
final WB_Map2D  context 
)
Parameters
outerPolygon
innerPolygons
optimize
context
Returns
WB_Triangulation2DWithPoints wblut.geom.WB_PolygonTriangulatorJTS.triangulatePolygon2D ( final int[]  polygon,
final WB_Coord[]  points,
final boolean  optimize,
final WB_Map2D  context 
)
Parameters
polygon
points
optimize
context
Returns
WB_Triangulation2D wblut.geom.WB_PolygonTriangulatorJTS.triangulatePolygon2D ( final int[]  polygon,
final List<?extends WB_Coord points,
final boolean  optimize,
final WB_Map2D  context 
)
Parameters
polygon
points
optimize
context
Returns
static int [] wblut.geom.WB_PolygonTriangulatorJTS.triangulateQuad ( final WB_Coord  p0,
final WB_Coord  p1,
final WB_Coord  p2,
final WB_Coord  p3 
)
static
Parameters
p0
p1
p2
p3
Returns
int [] wblut.geom.WB_PolygonTriangulatorJTS.triangulateSimplePolygon ( final WB_Polygon  polygon,
final boolean  optimize 
)

Member Data Documentation

final WB_GeometryFactory wblut.geom.WB_PolygonTriangulatorJTS.geometryfactory = new WB_GeometryFactory()
private
boolean [] wblut.geom.WB_PolygonTriangulatorJTS.shellCoordAvailable
private
List<Coordinate> wblut.geom.WB_PolygonTriangulatorJTS.shellCoords
private

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