Class SemiVirtualEdge
- java.lang.Object
-
- org.tinfour.semivirtual.SemiVirtualEdge
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all reference in the virtual edge.booleanequals(Object o)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.SemiVirtualEdgegetBaseReference()Constructs a new instance of the virtual edge class referencing the base of the current edge (may be a copy of the current edge if it is a base).intgetConstraintBorderIndex()Gets the index of the region-based constraint associated with an edge that serves as part of the polygon bounding that region.intgetConstraintIndex()Gets the index of the constraint associated with this edge.intgetConstraintLineIndex()Gets the index of a line-based constraint associated with an edge.intgetConstraintRegionInteriorIndex()Gets the index of the region-based constraint associated with an edge contained in the interior of a constraint polygon.SemiVirtualEdgegetDual()Constructs a new instance of the virtual edge class referencing the dual of the current edge.SemiVirtualEdgegetDualFromForward()Constructs a new instance of the virtual edge class referencing the dual of the forward of the current edgeSemiVirtualEdgegetDualFromReverse()Constructs a new instance of the virtual edge class referencing the dual of the current edge's reverse.SemiVirtualEdgegetForward()Gets the forward reference of the edge.SemiVirtualEdgegetForwardFromDual()Constructs a new instance of the virtual edge class referencing the forward of the dual of the current edgeintgetIndex()Gets the index value for this edge.doublegetLength()Gets the length of the edge.doublegetLengthSq()Gets the squared length of the edge.SemiVirtualEdgegetReverse()Constructs a new instance of the virtual edge class referencing the forward of the current edge.SemiVirtualEdgegetReverseFromDual()Constructs a new instance of the virtual edge class referencing the reverse of the dual of the current edgeintgetSide()Gets the low-order bit of the index of the current edgeVertexgetTriangleApex()When the edge exists within a TIN, this method gets the apex of a triangle formed with the edge as the base.inthashCode()booleanisConstrained()Indicates whether an edge is constrained.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.booleanisConstraintRegionBorder()Indicates whether an edge represents the border of a constrained region.booleanisConstraintRegionInterior()Indicates whether the edge is in the interior of a constrained region.booleanisConstraintRegionMember()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).booleanisExterior()Indicates if the edge is exterior to a TIN.booleanisSynthetic()Indicates whether the synthetic flag is set for the edge.voidloadForwardFromEdge(SemiVirtualEdge e)Load the content of the forward of the specified edgevoidloadReverseFromEdge(SemiVirtualEdge e)Load the content of the reverse of the specified edgeIterable<IQuadEdge>pinwheel()Gets an instance of an iterable that performs a pinwheel operation.voidsetA(Vertex a)Sets the initial vertex of the current edge (and final vertex of its dual)voidsetB(Vertex b)Sets the final vertex of the current edge (and initial vertex of its dual)voidsetConstraintBorderIndex(int constraintIndex)Sets a flag identifying the edge as the border of a region-based constraint and stores the index for that constraint.voidsetConstraintIndex(int constraintIndex)Sets the constraint index for this edge.voidsetConstraintLineIndex(int constraintIndex)Sets a flag identifying the edge as the border of a line-based constraint and stores the index for that constraint.voidsetConstraintLineMemberFlag()Sets the constraint-line member flag for the edge to true.voidsetConstraintRegionBorderFlag()Sets a flag indicating that the edge is an edge of a constrained region.voidsetConstraintRegionInteriorIndex(int constraintIndex)Sets a flag identifying the edge as an interior member of a region-based constraint and stores the index for that constraint.voidsetDualForward(SemiVirtualEdge forward)Sets the forward link for the dual of the current edge.voidsetDualReverse(SemiVirtualEdge reverse)Sets the reverse link for the dual of the current edge.voidsetForward(SemiVirtualEdge e)Sets the forward link for the current edge.voidsetLine2D(AffineTransform transform, Line2D l2d)A deprecated method replaced by the equivalent transcribeToLine2D().voidsetReverse(SemiVirtualEdge e)Sets the reverse link for the current edge.voidsetSynthetic(boolean status)Sets the synthetic flag for the edge.voidsetVertices(Vertex a, Vertex b)Sets both vertices for the current edge (and the opposite vertices of its dual).StringtoString()voidtranscribeToLine2D(AffineTransform transform, Line2D l2d)Provides a convenience method for rendering edges by setting the Line2D argument with the transformed coordinates of the edge.
-
-
-
Method Detail
-
loadForwardFromEdge
public void loadForwardFromEdge(SemiVirtualEdge e)
Load the content of the forward of the specified edge- Parameters:
e- a valid instance
-
loadReverseFromEdge
public void loadReverseFromEdge(SemiVirtualEdge e)
Load the content of the reverse of the specified edge- Parameters:
e- a valid instance
-
getA
public Vertex getA()
Description copied from interface:IQuadEdgeGets the initial vertex for this edge.
-
getB
public Vertex getB()
Description copied from interface:IQuadEdgeGets the second vertex for this edge.
-
getForward
public SemiVirtualEdge getForward()
Description copied from interface:IQuadEdgeGets the forward reference of the edge.- Specified by:
getForwardin interfaceIQuadEdge- Returns:
- a valid reference.
-
getTriangleApex
public Vertex getTriangleApex()
When the edge exists within a TIN, this method gets the apex of a triangle formed with the edge as the base.- Returns:
- if defined, a valid instance; otherwise, a null.
-
isExterior
public boolean isExterior()
Indicates if the edge is exterior to a TIN.- Returns:
- true if the edge is exterior; otherwise, false.
-
getReverse
public SemiVirtualEdge getReverse()
Constructs a new instance of the virtual edge class referencing the forward of the current edge.- Specified by:
getReversein interfaceIQuadEdge- Returns:
- a new instances
-
getDualFromReverse
public SemiVirtualEdge getDualFromReverse()
Constructs a new instance of the virtual edge class referencing the dual of the current edge's reverse.- Specified by:
getDualFromReversein interfaceIQuadEdge- Returns:
- a new instances
-
getDual
public SemiVirtualEdge getDual()
Constructs a new instance of the virtual edge class referencing the dual of the current edge.
-
clear
public void clear()
Clear all reference in the virtual edge.
-
getBaseReference
public SemiVirtualEdge getBaseReference()
Constructs a new instance of the virtual edge class referencing the base of the current edge (may be a copy of the current edge if it is a base).- Specified by:
getBaseReferencein interfaceIQuadEdge- Returns:
- a new instances
-
getBaseIndex
public int getBaseIndex()
Description copied from interface:IQuadEdgeGets 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.
- Specified by:
getBaseIndexin interfaceIQuadEdge- Returns:
- a positive, even value.
-
getForwardFromDual
public SemiVirtualEdge getForwardFromDual()
Constructs a new instance of the virtual edge class referencing the forward of the dual of the current edge- Specified by:
getForwardFromDualin interfaceIQuadEdge- Returns:
- a new instances
-
getDualFromForward
public SemiVirtualEdge getDualFromForward()
Constructs a new instance of the virtual edge class referencing the dual of the forward of the current edge- Returns:
- a new instances
-
getReverseFromDual
public SemiVirtualEdge getReverseFromDual()
Constructs a new instance of the virtual edge class referencing the reverse of the dual of the current edge- Specified by:
getReverseFromDualin interfaceIQuadEdge- Returns:
- a new instances
-
getIndex
public int getIndex()
Description copied from interface:IQuadEdgeGets 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.
-
getLength
public double getLength()
Description copied from interface:IQuadEdgeGets the length of the edge.
-
getLengthSq
public double getLengthSq()
Description copied from interface:IQuadEdgeGets the squared length of the edge.- Specified by:
getLengthSqin interfaceIQuadEdge- Returns:
- a positive floating point value
-
getSide
public int getSide()
Gets the low-order bit of the index of the current edge
-
setA
public void setA(Vertex a)
Sets the initial vertex of the current edge (and final vertex of its dual)- Parameters:
a- a valid reference or a null.
-
setB
public void setB(Vertex b)
Sets the final vertex of the current edge (and initial vertex of its dual)- Parameters:
b- a valid reference or a null.
-
setDualForward
public void setDualForward(SemiVirtualEdge forward)
Sets the forward link for the dual of the current edge.- Parameters:
forward- the forward reference/
-
setDualReverse
public void setDualReverse(SemiVirtualEdge reverse)
Sets the reverse link for the dual of the current edge.- Parameters:
reverse- the forward reference/
-
setForward
public void setForward(SemiVirtualEdge e)
Sets the forward link for the current edge.- Parameters:
e- the forward reference/
-
setReverse
public void setReverse(SemiVirtualEdge e)
Sets the reverse link for the current edge.- Parameters:
e- the forward reference/
-
setVertices
public void setVertices(Vertex a, Vertex b)
Sets both vertices for the current edge (and the opposite vertices of its dual).- Parameters:
a- the initial vertexb- the final vertex
-
getConstraintIndex
public int getConstraintIndex()
Description copied from interface:IQuadEdgeGets the index of the constraint associated with this edge.- Specified by:
getConstraintIndexin interfaceIQuadEdge- Returns:
- a positive value; may be zero if not specified.
-
setConstraintIndex
public void setConstraintIndex(int constraintIndex)
Description copied from interface:IQuadEdgeSets 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.- Specified by:
setConstraintIndexin interfaceIQuadEdge- Parameters:
constraintIndex- a positive number indicating which constraint a particular edge is associated with.
-
isConstrained
public boolean isConstrained()
Description copied from interface:IQuadEdgeIndicates whether an edge is constrained.- Specified by:
isConstrainedin interfaceIQuadEdge- Returns:
- true if the edge is constrained; otherwise, false.
-
isConstraintRegionBorder
public boolean isConstraintRegionBorder()
Description copied from interface:IQuadEdgeIndicates 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.- Specified by:
isConstraintRegionBorderin interfaceIQuadEdge- Returns:
- true if the edge is the border of the constrained region; otherwise, false.
-
isConstraintRegionInterior
public boolean isConstraintRegionInterior()
Description copied from interface:IQuadEdgeIndicates 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.- Specified by:
isConstraintRegionInteriorin interfaceIQuadEdge- Returns:
- true if the edge is in the interior of an region; otherwise false.
-
isConstraintRegionMember
public boolean isConstraintRegionMember()
Description copied from interface:IQuadEdgeIndicates 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.- Specified by:
isConstraintRegionMemberin interfaceIQuadEdge- Returns:
- true if the edge is a member of an region; otherwise false.
-
setConstraintRegionBorderFlag
public void setConstraintRegionBorderFlag()
Description copied from interface:IQuadEdgeSets a flag indicating that the edge is an edge of a constrained region.- Specified by:
setConstraintRegionBorderFlagin interfaceIQuadEdge
-
isConstraintLineMember
public boolean isConstraintLineMember()
Description copied from interface:IQuadEdgeIndicates 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.- Specified by:
isConstraintLineMemberin interfaceIQuadEdge- Returns:
- true if the edge is a member of an region; otherwise false.
-
setConstraintLineMemberFlag
public void setConstraintLineMemberFlag()
Description copied from interface:IQuadEdgeSets the constraint-line member flag for the edge to true.- Specified by:
setConstraintLineMemberFlagin interfaceIQuadEdge
-
pinwheel
public Iterable<IQuadEdge> pinwheel()
Description copied from interface:IQuadEdgeGets 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 } }
-
setSynthetic
public void setSynthetic(boolean status)
Description copied from interface:IQuadEdgeSets 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.- Specified by:
setSyntheticin interfaceIQuadEdge- Parameters:
status- true if the edge is synthetic; otherwise, false.
-
isSynthetic
public boolean isSynthetic()
Description copied from interface:IQuadEdgeIndicates whether the synthetic flag is set for the edge.- Specified by:
isSyntheticin interfaceIQuadEdge- Returns:
- true if the edge is synthetic; otherwise, false.
-
setLine2D
public void setLine2D(AffineTransform transform, Line2D l2d)
Description copied from interface:IQuadEdgeA deprecated method replaced by the equivalent transcribeToLine2D().
-
transcribeToLine2D
public void transcribeToLine2D(AffineTransform transform, Line2D l2d)
Description copied from interface:IQuadEdgeProvides 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. If a null reference is supplied for the transform, this method treats it as the identity transform.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.
- Specified by:
transcribeToLine2Din interfaceIQuadEdge- Parameters:
transform- a valid affine transforml2d- a valid Line2D instance to receive the geometry data from the edge.
-
setConstraintBorderIndex
public void setConstraintBorderIndex(int constraintIndex)
Description copied from interface:IQuadEdgeSets a flag identifying the edge as the border of a region-based constraint and stores the index for that constraint.- Specified by:
setConstraintBorderIndexin interfaceIQuadEdge- Parameters:
constraintIndex- a positive integer in the range zero to 8190, or -1 for a null constraint.
-
getConstraintBorderIndex
public int getConstraintBorderIndex()
Description copied from interface:IQuadEdgeGets the index of the region-based constraint associated with an edge that serves as part of the polygon bounding that region.- Specified by:
getConstraintBorderIndexin interfaceIQuadEdge- Returns:
- a positive integer or -1 if no constraint is specified.
-
setConstraintLineIndex
public void setConstraintLineIndex(int constraintIndex)
Description copied from interface:IQuadEdgeSets a flag identifying the edge as the border of a line-based constraint and stores the index for that constraint.- Specified by:
setConstraintLineIndexin interfaceIQuadEdge- Parameters:
constraintIndex- a positive integer in range zero to 8190
-
setConstraintRegionInteriorIndex
public void setConstraintRegionInteriorIndex(int constraintIndex)
Description copied from interface:IQuadEdgeSets a flag identifying the edge as an interior member of a region-based constraint and stores the index for that constraint.- Specified by:
setConstraintRegionInteriorIndexin interfaceIQuadEdge- Parameters:
constraintIndex- a positive integer in the range 0 to 8190, or -1 for a null value
-
getConstraintRegionInteriorIndex
public int getConstraintRegionInteriorIndex()
Description copied from interface:IQuadEdgeGets the index of the region-based constraint associated with an edge contained in the interior of a constraint polygon. The edge itself is not necessarily constrained and is not part of the definition for the polygon.- Specified by:
getConstraintRegionInteriorIndexin interfaceIQuadEdge- Returns:
- a positive integer or -1 if no constraint is specified.
-
getConstraintLineIndex
public int getConstraintLineIndex()
Description copied from interface:IQuadEdgeGets the index of a line-based constraint associated with an edge. The edge is constrained. Due to limitations of memory, the Tinfour implementation cannot support an index for an edge that happens to be a member of multiple constraints (as in the case of an edge that is also part of a border constraint).- Specified by:
getConstraintLineIndexin interfaceIQuadEdge- Returns:
- a positive integer or -1 is no constraint index is available.
-
-