Class QuadEdge
- java.lang.Object
-
- org.meteoinfo.jts.triangulate.quadedge.QuadEdge
-
public class QuadEdge extends java.lang.ObjectA class that represents the edge data structure which implements the quadedge algebra. The quadedge algebra was described in a well-known paper by Guibas and Stolfi, "Primitives for the manipulation of general subdivisions and the computation of Voronoi diagrams", ACM Transactions on Graphics, 4(2), 1985, 75-123.Each edge object is part of a quartet of 4 edges, linked via their rot references. Any edge in the group may be accessed using a series of
rot()operations. Quadedges in a subdivision are linked together via their next references. The linkage between the quadedge quartets determines the topology of the subdivision.The edge class does not contain separate information for vertice or faces; a vertex is implicitly defined as a ring of edges (created using the next field).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static QuadEdgeconnect(QuadEdge a, QuadEdge b)Creates a new QuadEdge connecting the destination of a to the origin of b, in such a way that all three have the same left face after the connection is complete.voiddelete()Marks this quadedge as being deleted.Vertexdest()Gets the vertex for the edge's destinationQuadEdgedNext()Gets the next CCW edge around (into) the destination of this edge.QuadEdgedPrev()Gets the next CW edge around (into) the destination of this edge.booleanequalsNonOriented(QuadEdge qe)Tests if this quadedge and another have the same line segment geometry, regardless of orientation.booleanequalsOriented(QuadEdge qe)Tests if this quadedge and another have the same line segment geometry with the same orientation.java.lang.ObjectgetData()Gets the external data value for this edge.doublegetLength()Gets the length of the geometry of this quadedge.QuadEdgegetPrimary()Gets the primary edge of this quadedge and its sym.QuadEdgeinvRot()Gets the dual of this edge, directed from its left to its right.booleanisLive()Tests whether this edge has been deleted.QuadEdgelNext()Gets the CCW edge around the left face following this edge.QuadEdgelPrev()Gets the CCW edge around the left face before this edge.static QuadEdgemakeEdge(Vertex o, Vertex d)QuadEdgeoNext()Gets the next CCW edge around the origin of this edge.QuadEdgeoPrev()Gets the next CW edge around (from) the origin of this edge.Vertexorig()Gets the vertex for the edge's originQuadEdgerNext()Gets the edge around the right face ccw following this edge.QuadEdgerot()Gets the dual of this edge, directed from its right to its left.QuadEdgerPrev()Gets the edge around the right face ccw before this edge.voidsetData(java.lang.Object data)Sets the external data value for this edge.voidsetNext(QuadEdge next)Sets the connected edgestatic voidsplice(QuadEdge a, QuadEdge b)Splices two edges together or apart.static voidswap(QuadEdge e)Turns an edge counterclockwise inside its enclosing quadrilateral.QuadEdgesym()Gets the edge from the destination to the origin of this edge.LineSegmenttoLineSegment()Creates aLineSegmentrepresenting the geometry of this edge.java.lang.StringtoString()Converts this edge to a WKT two-point LINESTRING indicating the geometry of this edge.
-
-
-
Method Detail
-
makeEdge
public static QuadEdge makeEdge(Vertex o, Vertex d)
- Parameters:
o- the origin Vertexd- the destination Vertex- Returns:
- the new QuadEdge quartet
-
connect
public static QuadEdge connect(QuadEdge a, QuadEdge b)
Creates a new QuadEdge connecting the destination of a to the origin of b, in such a way that all three have the same left face after the connection is complete. Additionally, the data pointers of the new edge are set.- Returns:
- the connected edge.
-
splice
public static void splice(QuadEdge a, QuadEdge b)
Splices two edges together or apart. Splice affects the two edge rings around the origins of a and b, and, independently, the two edge rings around the left faces of a and b. In each case, (i) if the two rings are distinct, Splice will combine them into one, or (ii) if the two are the same ring, Splice will break it into two separate pieces. Thus, Splice can be used both to attach the two edges together, and to break them apart.- Parameters:
a- an edge to spliceb- an edge to splice
-
swap
public static void swap(QuadEdge e)
Turns an edge counterclockwise inside its enclosing quadrilateral.- Parameters:
e- the quadedge to turn
-
getPrimary
public QuadEdge getPrimary()
Gets the primary edge of this quadedge and its sym. The primary edge is the one for which the origin and destination coordinates are ordered according to the standardCoordinateordering- Returns:
- the primary quadedge
-
setData
public void setData(java.lang.Object data)
Sets the external data value for this edge.- Parameters:
data- an object containing external data
-
getData
public java.lang.Object getData()
Gets the external data value for this edge.- Returns:
- the data object
-
delete
public void delete()
Marks this quadedge as being deleted. This does not free the memory used by this quadedge quartet, but indicates that this edge no longer participates in a subdivision.
-
isLive
public boolean isLive()
Tests whether this edge has been deleted.- Returns:
- true if this edge has not been deleted.
-
setNext
public void setNext(QuadEdge next)
Sets the connected edge- Parameters:
next- edge
-
rot
public final QuadEdge rot()
Gets the dual of this edge, directed from its right to its left.- Returns:
- the rotated edge
-
invRot
public final QuadEdge invRot()
Gets the dual of this edge, directed from its left to its right.- Returns:
- the inverse rotated edge.
-
sym
public final QuadEdge sym()
Gets the edge from the destination to the origin of this edge.- Returns:
- the sym of the edge
-
oNext
public final QuadEdge oNext()
Gets the next CCW edge around the origin of this edge.- Returns:
- the next linked edge.
-
oPrev
public final QuadEdge oPrev()
Gets the next CW edge around (from) the origin of this edge.- Returns:
- the previous edge.
-
dNext
public final QuadEdge dNext()
Gets the next CCW edge around (into) the destination of this edge.- Returns:
- the next destination edge.
-
dPrev
public final QuadEdge dPrev()
Gets the next CW edge around (into) the destination of this edge.- Returns:
- the previous destination edge.
-
lNext
public final QuadEdge lNext()
Gets the CCW edge around the left face following this edge.- Returns:
- the next left face edge.
-
lPrev
public final QuadEdge lPrev()
Gets the CCW edge around the left face before this edge.- Returns:
- the previous left face edge.
-
rNext
public final QuadEdge rNext()
Gets the edge around the right face ccw following this edge.- Returns:
- the next right face edge.
-
rPrev
public final QuadEdge rPrev()
Gets the edge around the right face ccw before this edge.- Returns:
- the previous right face edge.
-
orig
public final Vertex orig()
Gets the vertex for the edge's origin- Returns:
- the origin vertex
-
dest
public final Vertex dest()
Gets the vertex for the edge's destination- Returns:
- the destination vertex
-
getLength
public double getLength()
Gets the length of the geometry of this quadedge.- Returns:
- the length of the quadedge
-
equalsNonOriented
public boolean equalsNonOriented(QuadEdge qe)
Tests if this quadedge and another have the same line segment geometry, regardless of orientation.- Parameters:
qe- a quadege- Returns:
- true if the quadedges are based on the same line segment regardless of orientation
-
equalsOriented
public boolean equalsOriented(QuadEdge qe)
Tests if this quadedge and another have the same line segment geometry with the same orientation.- Parameters:
qe- a quadege- Returns:
- true if the quadedges are based on the same line segment
-
toLineSegment
public LineSegment toLineSegment()
Creates aLineSegmentrepresenting the geometry of this edge.- Returns:
- a LineSegment
-
toString
public java.lang.String toString()
Converts this edge to a WKT two-point LINESTRING indicating the geometry of this edge.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String representing this edge's geometry
-
-