public class QuadEdgeTriangle extends Object
QuadEdge
s in a QuadEdgeSubdivision
which forms a triangulation. The class provides methods to access the
topological and geometric properties of the triangle and its neighbours in
the triangulation. Triangle vertices are ordered in CCW orientation in the
structure.
QuadEdgeTriangles support having an external data attribute attached to them. Alternatively, this class can be subclassed and attributes can be defined in the subclass. Subclasses will need to define their own BuilderVisitor class and createOn method.
Constructor and Description |
---|
QuadEdgeTriangle(QuadEdge[] edge)
Creates a new triangle from the given edges.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Coordinate pt) |
static boolean |
contains(QuadEdge[] tri,
Coordinate pt)
Tests whether the point pt is contained in the triangle defined by 3
QuadEdge es. |
static boolean |
contains(Vertex[] tri,
Coordinate pt)
Tests whether the point pt is contained in the triangle defined by 3
Vertex es. |
static List |
createOn(QuadEdgeSubdivision subdiv)
Creates
QuadEdgeTriangle s for all facets of a
QuadEdgeSubdivision representing a triangulation. |
QuadEdgeTriangle |
getAdjacentTriangleAcrossEdge(int edgeIndex) |
int |
getAdjacentTriangleEdgeIndex(int i) |
Coordinate |
getCoordinate(int i) |
Coordinate[] |
getCoordinates() |
Object |
getData()
Gets the external data value for this triangle.
|
QuadEdge |
getEdge(int i) |
int |
getEdgeIndex(QuadEdge e)
Gets the index for the given edge of this triangle
|
int |
getEdgeIndex(Vertex v)
Gets the index for the edge that starts at vertex v.
|
QuadEdge[] |
getEdges() |
void |
getEdgeSegment(int i,
LineSegment seg) |
Polygon |
getGeometry(GeometryFactory fact) |
QuadEdgeTriangle[] |
getNeighbours()
Gets the neighbours of this triangle.
|
List |
getTrianglesAdjacentToVertex(int vertexIndex)
Gets the triangles which are adjacent (include) to a
given vertex of this triangle.
|
Vertex |
getVertex(int i) |
Vertex[] |
getVertices()
Gets the vertices for this triangle.
|
boolean |
isBorder()
Tests whether this triangle is adjacent to the outside of the subdivision.
|
boolean |
isBorder(int i) |
boolean |
isLive() |
void |
kill() |
static int |
nextIndex(int index)
Finds the next index around the triangle.
|
void |
setData(Object data)
Sets the external data value for this triangle.
|
static Geometry |
toPolygon(QuadEdge[] e) |
static Geometry |
toPolygon(Vertex[] v) |
String |
toString() |
public QuadEdgeTriangle(QuadEdge[] edge)
edge
- an array of the edges of the triangle in CCW orderpublic static List createOn(QuadEdgeSubdivision subdiv)
QuadEdgeTriangle
s for all facets of a
QuadEdgeSubdivision
representing a triangulation.
The data attributes of the QuadEdge
s in the subdivision
will be set to point to the triangle which contains that edge.
This allows tracing the neighbour triangles of any given triangle.subdiv
- the QuadEdgeSubdivision to create the triangles on.public static boolean contains(Vertex[] tri, Coordinate pt)
Vertex
es.tri
- an array containing at least 3 Vertexespt
- the point to testpublic static boolean contains(QuadEdge[] tri, Coordinate pt)
QuadEdge
es.tri
- an array containing at least 3 QuadEdgespt
- the point to testpublic static int nextIndex(int index)
index
- public void setData(Object data)
data
- an object containing external datapublic Object getData()
public void kill()
public boolean isLive()
public QuadEdge[] getEdges()
public QuadEdge getEdge(int i)
public Vertex getVertex(int i)
public Vertex[] getVertices()
public Coordinate getCoordinate(int i)
public int getEdgeIndex(QuadEdge e)
e
- a QuadEdgepublic int getEdgeIndex(Vertex v)
v
- the vertex to find the edge forpublic void getEdgeSegment(int i, LineSegment seg)
public Coordinate[] getCoordinates()
public boolean contains(Coordinate pt)
public Polygon getGeometry(GeometryFactory fact)
public boolean isBorder()
public boolean isBorder(int i)
public QuadEdgeTriangle getAdjacentTriangleAcrossEdge(int edgeIndex)
public int getAdjacentTriangleEdgeIndex(int i)
public List getTrianglesAdjacentToVertex(int vertexIndex)
vertexIndex
- the vertex to querypublic QuadEdgeTriangle[] getNeighbours()
null
Copyright © 2024. All rights reserved.