public class QuadEdge extends Object implements IQuadEdge
This concept is based on the structure popularized by Guibas, L. and Stolfi, J. (1985) "Primitives for the manipulation of subdivisions and the computation of Voronoi diagrams" ACM Transactions on Graphics, 4(2), 1985, p. 75-123.
Constructor and Description |
---|
QuadEdge(int index)
Construct the edge and its dual assigning the pair the specified index.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Sets all vertices and link references to null (the link to a dual
is not affected).
|
boolean |
equals(Object o)
An implementation of the equals method which check for a matching
reference.
|
Vertex |
getA()
Gets the initial vertex for this edge.
|
Vertex |
getB()
Gets the second vertex for this edge.
|
int |
getBaseIndex()
Gets the index of the "base" side of a bi-directional edge.
|
QuadEdge |
getBaseReference()
Gets the reference to the side-zero edge of the pair.
|
int |
getConstraintIndex()
Gets the index of the constraint associated with this edge.
|
QuadEdge |
getDual()
Gets the dual edge to this instance.
|
QuadEdge |
getDualFromReverse()
Gets the dual of the reverse link.
|
QuadEdge |
getForward()
Gets the forward reference of the edge.
|
QuadEdge |
getForwardFromDual()
Gets the forward reference of the dual.
|
int |
getIndex()
Gets the index value for this edge.
|
double |
getLength()
Gets the length of the edge.
|
QuadEdge |
getReverse()
Gets the reverse reference of the edge.
|
QuadEdge |
getReverseFromDual()
Gets the reverse link of the dual.
|
int |
getSide()
Indicates which side of an edge a particular QuadEdge instance is
attached to.
|
int |
hashCode() |
boolean |
isConstrained()
Gets the index of the constrain associated with
|
boolean |
isConstrainedRegionBorder()
Indicates whether an edge represents the border of a constrained
region.
|
boolean |
isConstrainedRegionInterior()
Indicates whether the edge is in the interior of a constrained region.
|
boolean |
isConstrainedRegionMember()
Indicates whether the edge is a member of a constrained region
(is in the interior or serves as the border of a polygon-based constraint).
|
boolean |
isConstraintLineMember()
Indicates whether the edge is a member of a constraint line, In some
cases, a constraint line member edge may lie within a constrained region
but will not lie on one of its borders.
|
boolean |
isSynthetic()
Indicates whether the synthetic flag is set for the edge.
|
Iterable<IQuadEdge> |
pinwheel()
Gets an instance of an iterable that performs a pinwheel operation.
|
void |
setA(Vertex a)
Sets the initial vertex for this edge.
|
void |
setB(Vertex b)
Sets the second (B) vertex for this edge (also the A reference of
the dual edge).
|
void |
setConstrained(int constraintIndex)
Sets an edge as constrained and sets its constraint index.
|
void |
setConstrainedRegionBorderFlag()
Sets a flag indicating that the edge is an edge of a constrained region.
|
void |
setConstrainedRegionInteriorFlag()
Sets the constrained region membership flag for the edge to true.
|
void |
setConstraintIndex(int constraintIndex)
Sets the constraint index for this edge.
|
void |
setConstraintLineMemberFlag()
Sets the constraint-line member flag for the edge to true.
|
void |
setDualForward(QuadEdge e)
Sets the forward link to the dual of this edge.
|
void |
setDualReverse(QuadEdge e)
Sets the reverse link of the dual to this edge.
|
void |
setForward(QuadEdge e)
Sets the forward reference for this edge.
|
protected void |
setIndex(int index)
Sets the index value for this edge.
|
void |
setLine2D(AffineTransform transform,
Line2D l2d)
Provides a convenience method for rendering edges by setting the
Line2D argument with the transformed coordinates of the edge.
|
void |
setReverse(QuadEdge e)
Sets the reverse reference for this edge.
|
void |
setSynthetic(boolean status)
Sets the synthetic flag for the edge.
|
void |
setVertices(Vertex a,
Vertex b)
Sets the vertices for this edge (and its dual).
|
String |
toString() |
public QuadEdge(int index)
index
- an arbitrary integer value.public void setVertices(Vertex a, Vertex b)
a
- the initial vertex, must be a valid reference.b
- the second vertex, may be a valid reference or a
null for a ghost edge.public final Vertex getA()
public final void setA(Vertex a)
a
- a valid reference.public final Vertex getB()
public final void setB(Vertex b)
b
- a valid reference or a null for a ghost edge.public final QuadEdge getForward()
getForward
in interface IQuadEdge
public final QuadEdge getReverse()
getReverse
in interface IQuadEdge
public final QuadEdge getForwardFromDual()
getForwardFromDual
in interface IQuadEdge
public final QuadEdge getReverseFromDual()
getReverseFromDual
in interface IQuadEdge
public final QuadEdge getDualFromReverse()
getDualFromReverse
in interface IQuadEdge
public final void setForward(QuadEdge e)
e
- a valid referencepublic final void setReverse(QuadEdge e)
e
- a valid referencepublic final void setDualForward(QuadEdge e)
e
- a valid referencepublic final void setDualReverse(QuadEdge e)
e
- a valid referencepublic final QuadEdge getDual()
public int getIndex()
public int getBaseIndex()
IQuadEdge
This method can be useful in cases where an application needs to track a complete edge without regard to which side of the edge is being considered.
getBaseIndex
in interface IQuadEdge
protected void setIndex(int index)
index
- an integer valuepublic QuadEdge getBaseReference()
getBaseReference
in interface IQuadEdge
public int getConstraintIndex()
getConstraintIndex
in interface IQuadEdge
public void setConstraintIndex(int constraintIndex)
IQuadEdge
setConstraintIndex
in interface IQuadEdge
constraintIndex
- a positive number indicating which constraint
a particular edge is associated with.public boolean isConstrained()
isConstrained
in interface IQuadEdge
public void setConstrained(int constraintIndex)
IQuadEdge
setConstrained
in interface IQuadEdge
constraintIndex
- positive number indicating which constraint
a particular edge is associated with.public void clear()
public double getLength()
public int getSide()
public boolean equals(Object o)
public boolean isConstrainedRegionMember()
IQuadEdge
isConstrainedRegionMember
in interface IQuadEdge
public boolean isConstrainedRegionInterior()
IQuadEdge
isConstrainedRegionInterior
in interface IQuadEdge
public boolean isConstrainedRegionBorder()
IQuadEdge
isConstrainedRegionBorder
in interface IQuadEdge
public boolean isConstraintLineMember()
IQuadEdge
isConstraintLineMember
in interface IQuadEdge
public void setConstraintLineMemberFlag()
IQuadEdge
setConstraintLineMemberFlag
in interface IQuadEdge
public void setConstrainedRegionBorderFlag()
IQuadEdge
setConstrainedRegionBorderFlag
in interface IQuadEdge
public void setConstrainedRegionInteriorFlag()
IQuadEdge
setConstrainedRegionInteriorFlag
in interface IQuadEdge
public void setSynthetic(boolean status)
IQuadEdge
setSynthetic
in interface IQuadEdge
status
- true if the edge is synthetic; otherwise, false.public boolean isSynthetic()
IQuadEdge
isSynthetic
in interface IQuadEdge
public Iterable<IQuadEdge> pinwheel()
IQuadEdge
for(IQuadEdge e: startingEdge.pinwheel()){ }
public void setLine2D(AffineTransform transform, Line2D l2d)
IQuadEdge
This method is intended to support rendering operations that may render a large number of edges using Java's Line2D class. In such cases, this method avoids the overhead involved in creating multiple Line2D instances by allowing an application to reuse a single instance multiple times.
Copyright © 2021. All rights reserved.