Interface IQuadEdge
-
- All Known Implementing Classes:
QuadEdge,SemiVirtualEdge
public interface IQuadEdgeDefines methods for accessing the data in a quad-edge implementation.In general, get operations can be performed without any degradation of performance. However, set operations on quad-edges often require down casting (narrow casting) of object references. In ordinary applications, the performance cost of down casting is small. But for TIN applications require very large data sets with repeated modifications to the edge structure of the TIN, this cost can degrade processing rates by as much as 25 percent. Thus this interface avoids specifying any methods that set edge relationships (connections).
See the definition of IConstraint for a discussion of constrained regions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VertexgetA()Gets the initial vertex for this edge.VertexgetB()Gets the second vertex for this edge.intgetBaseIndex()Gets the index of the "base" side of a bi-directional edge.IQuadEdgegetBaseReference()Gets the reference to the side-zero edge of the pair.intgetConstraintIndex()Gets the index of the constraint associated with this edge.IQuadEdgegetDual()Gets the dual edge to this instance.IQuadEdgegetDualFromReverse()Gets the dual of the reverse reference of the edge.IQuadEdgegetForward()Gets the forward reference of the edge.IQuadEdgegetForwardFromDual()Gets the forward reference of the dual.intgetIndex()Gets the index value for this edge.doublegetLength()Gets the length of the edge.IQuadEdgegetReverse()Gets the reverse reference of the edge.IQuadEdgegetReverseFromDual()Gets the reverse link of the dual.intgetSide()Indicates which side of an edge a particular IQuadEdge instance is attached to.booleanisConstrained()Indicates whether an edge is constrained.booleanisConstrainedRegionBorder()Indicates whether an edge represents the border of a constrained region.booleanisConstrainedRegionInterior()Indicates whether the edge is in the interior of a constrained region.booleanisConstrainedRegionMember()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).booleanisConstraintLineMember()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.booleanisSynthetic()Indicates whether the synthetic flag is set for the edge.Iterable<IQuadEdge>pinwheel()Gets an instance of an iterable that performs a pinwheel operation.voidsetConstrained(int constraintIndex)Sets an edge as constrained and sets its constraint index.voidsetConstrainedRegionBorderFlag()Sets a flag indicating that the edge is an edge of a constrained region.voidsetConstrainedRegionInteriorFlag()Sets the constrained region membership flag for the edge to true.voidsetConstraintIndex(int constraintIndex)Sets the constraint index for this edge.voidsetConstraintLineMemberFlag()Sets the constraint-line member flag for the edge to true.voidsetLine2D(AffineTransform transform, Line2D l2d)Provides a convenience method for rendering edges by setting the Line2D argument with the transformed coordinates of the edge.voidsetSynthetic(boolean status)Sets the synthetic flag for the edge.
-
-
-
Method Detail
-
getA
Vertex getA()
Gets the initial vertex for this edge.- Returns:
- a valid reference.
-
getB
Vertex getB()
Gets the second vertex for this edge.- Returns:
- a valid reference or a null for a ghost edge.
-
getBaseReference
IQuadEdge getBaseReference()
Gets the reference to the side-zero edge of the pair.From the perspective of application code, the Tinfour implementations of the two elements associated with a bi-directional edge are symmetrical. Neither side of an edge is more significant than the other.
- Returns:
- a reference to the side-zero edge of the pair.
-
getDual
IQuadEdge getDual()
Gets the dual edge to this instance.- Returns:
- a valid edge.
-
getForwardFromDual
IQuadEdge getForwardFromDual()
Gets the forward reference of the dual.- Returns:
- a valid reference
-
getReverseFromDual
IQuadEdge getReverseFromDual()
Gets the reverse link of the dual.- Returns:
- a valid reference
-
getIndex
int getIndex()
Gets the index value for this edge. In general, the index value is intended for memory management and edge pools. So while application code may read index values, it is not generally enabled to set them.In Tinfour implementations, edges are bi-directional. In effect, the edge is implemented as a pair of unidirectional elements. Each element is assigned a separate index.
One common use for the index code by applications is to main a record of processing performed using edge-traversal operations. For example, some applications use the index to maintain a bitmap of visited edges when performing surface analysis.
When an edge is allocated, it is set with an arbitrary index value. This value will not change while the edge remains allocated by and edge-pool instance. As soon as the edge is released, it is likely to have its index value reassigned.
- Returns:
- a positive integer value
-
getBaseIndex
int getBaseIndex()
Gets the index of the "base" side of a bi-directional edge. In Tinfour implementations, edges are bi-directional. In effect, the edge is implemented as a pair of unidirectional elements. Each element is assigned a separate index. The first element in the pair is designated as the "base" and is assigned an even-valued index. Its dual is assigned a value one greater than the base index. This method always returns an even value.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.
- Returns:
- a positive, even value.
-
getSide
int getSide()
Indicates which side of an edge a particular IQuadEdge instance is attached to. The side value is a strictly arbitrary index used for algorithms that need to be able to assign a unique index to both sides of an edge.- Returns:
- a value of 0 or 1.
-
getLength
double getLength()
Gets the length of the edge.- Returns:
- a positive floating point value
-
getForward
IQuadEdge getForward()
Gets the forward reference of the edge.- Returns:
- a valid reference.
-
getReverse
IQuadEdge getReverse()
Gets the reverse reference of the edge.- Returns:
- a valid reference.
-
getDualFromReverse
IQuadEdge getDualFromReverse()
Gets the dual of the reverse reference of the edge.- Returns:
- a valid reference.
-
getConstraintIndex
int getConstraintIndex()
Gets the index of the constraint associated with this edge.- Returns:
- a positive value; may be zero if not specified.
-
setConstraintIndex
void setConstraintIndex(int constraintIndex)
Sets the constraint index for this edge. This method does not necessarily set an edge to a constrained status. In some implementations the constraint index may be used as a way of associating ordinary edges with a neighboring constraint. Constraint index values must be positive integers. The range of supported values will depend on the specific class that implements this interface. Please refer to the class documentation for specific values.- Parameters:
constraintIndex- a positive number indicating which constraint a particular edge is associated with.
-
isConstrained
boolean isConstrained()
Indicates whether an edge is constrained.- Returns:
- true if the edge is constrained; otherwise, false.
-
setConstrained
void setConstrained(int constraintIndex)
Sets an edge as constrained and sets its constraint index. Note that once an edge is constrained, it cannot be set to a non-constrained status. Constraint index values must be positive integers. The range of supported values will depend on the specific class that implements this interface. Please refer to the class documentation for specific values.- Parameters:
constraintIndex- positive number indicating which constraint a particular edge is associated with.
-
isConstrainedRegionMember
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). A constrained region member is not necessarily a constrained edge.- Returns:
- true if the edge is a member of an region; otherwise false.
-
isConstraintLineMember
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.- Returns:
- true if the edge is a member of an region; otherwise false.
-
setConstraintLineMemberFlag
void setConstraintLineMemberFlag()
Sets the constraint-line member flag for the edge to true.
-
isConstrainedRegionInterior
boolean isConstrainedRegionInterior()
Indicates whether the edge is in the interior of a constrained region. Both sides of the edge lie within the interior of the region. All points along the edge will lie within the interior of the region with the possible exception of the endpoints. The endpoints may lie on the border of the region. An interior edge for a constrained region is not a constrained edge. Interior edges are also classified as "member" edges of a constrained region.- Returns:
- true if the edge is in the interior of an region; otherwise false.
-
isConstrainedRegionBorder
boolean isConstrainedRegionBorder()
Indicates whether an edge represents the border of a constrained region. Border edges will always be constrained. Border edges are also classified as "member" edges of a constrained region.- Returns:
- true if the edge is the border of the constrained region; otherwise, false.
-
setConstrainedRegionBorderFlag
void setConstrainedRegionBorderFlag()
Sets a flag indicating that the edge is an edge of a constrained region.
-
setConstrainedRegionInteriorFlag
void setConstrainedRegionInteriorFlag()
Sets the constrained region membership flag for the edge to true.
-
setSynthetic
void setSynthetic(boolean status)
Sets the synthetic flag for the edge. Synthetic edges are those that do not arise naturally from the TIN-building logic but are created by special operations.- Parameters:
status- true if the edge is synthetic; otherwise, false.
-
isSynthetic
boolean isSynthetic()
Indicates whether the synthetic flag is set for the edge.- Returns:
- true if the edge is synthetic; otherwise, false.
-
pinwheel
Iterable<IQuadEdge> pinwheel()
Gets an instance of an iterable that performs a pinwheel operation. This instance may be used in a Java for statementfor(IQuadEdge e: startingEdge.pinwheel()){ }About the pinwheel operation: In the Tinfour library, a pinwheel operation interates over the set of edges that connect to the initial vertex of the current edge. The initial vertex is the one returned from a call to getA(). Connected vertices may be obtained through a call to getB().
Null references for vertex:If vertex A lies on the perimeter of the Delaunay mesh, one or more of the connected edges may terminate on the "ghost vertex" which is used by Tinfour to complete the triangulation. The ghost vertex is represented by a null reference. So applications performing a pinwheel on an arbitrary edge should include logic to handle a null return from the getB() method.
for(IQuadEdge e: startingEdge.pinwheel()){ Vertex B = e.getB(); if(B == null){ // skip processing }else { // perform processing using B } }- Returns:
- a valid Iterable.
-
setLine2D
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. The affine transform is used to map vertex A and B of the edge to the specified coordinate system. The transformed coordinates are then stored in the application-supplied Line2D object.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.
- Parameters:
transform- a valid affine transforml2d- a valid Line2D instance
-
-