Package org.tinfour.common
Class Vertex
- java.lang.Object
-
- org.tinfour.common.Vertex
-
- All Implemented Interfaces:
ISamplePoint
- Direct Known Subclasses:
VertexAdjustment,VertexMergerGroup
public class Vertex extends Object implements ISamplePoint
Represents a point in a connected network on a planar surface.
-
-
Field Summary
Fields Modifier and Type Field Description protected byteauxiliaryThe auxiliary index used for graph coloring algorithms and other applications.static intBIT_CONSTRAINTA bit flag indicating that the vertex is a member of a constraint edge.static intBIT_REFINEMENTA bit flag indication that the vertex was created by a Delaunay refinement algorithm or other technique used to improve the quality of the triangular mesh.static intBIT_SYNTHETICA bit flag indicating that the vertex is synthetic and was created through some form of mesh processing rather than being supplied as a data sample.static intBIT_WITHHELDA bit flag indicating that the vertex is to be treated as "withheld" and should not be processed as part of a Delaunay triangulation (TIN).protected bytereserved0An unused field reserved for use by applications and derived classesprotected bytereserved1An unused field reserved for use by applications and derived classesprotected bytestatusThe bit-mapped status flags for the vertex.doublexThe Cartesian coordinate of the vertex (immutable).doubleyThe Cartesian coordinate of the vertex (immutable).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAuxiliaryIndex()Gets the auxiliary index for the vertex.doublegetDistance(double x, double y)Gets the distance from the vertex to an arbitrary point.doublegetDistance(Vertex v)Get the distance to the vertex.doublegetDistanceSq(double x, double y)Gets the square of the distance from the vertex to an arbitrary point.doublegetDistanceSq(Vertex v)Get the square of the distance to the vertex.intgetIndex()Gets the arbitrary index associated with the vertex.StringgetLabel()Gets a string intended for labeling the vertex in images or reports.intgetStatus()Gets the current value of the status flags for this vertex.doublegetX()Get the x coordinate associated with the vertex.doublegetY()Get the y coordinate associated with the vertex.doublegetZ()Get the z value associated with the vertex.booleanisConstraintMember()Indicates whether a vertex is part of a constraint definition or lies on the border of an area constraint.booleanisNull()Indicates whether the vertex has been marked as having a null data value.booleanisRefinementProduct()Indicates whether a vertex is a refinement product (was created through a Delaunay refinement procedure rather than supplied by an application).booleanisSynthetic()Indicates whether a vertex is synthetic (was created through a Tinfour procedure rather than supplied by an application).booleanisWithheld()Indicates whether a vertex is marked as withheld.voidsetAuxiliaryIndex(int auxiliaryIndex)Sets the auxiliary index for the vertex.voidsetConstraintMember(boolean constraintMember)Sets or clears the is-constraint-member status of a vertex.voidsetIndex(int index)Sets the arbitrary index associated with the vertex.voidsetRefinementProduct(boolean refinement)Sets or clears the is-refinement-product status of a vertex.voidsetStatus(int status)Sets the status value of the vertex.voidsetSynthetic(boolean synthetic)Sets or clears the is-synthetic status of a vertex.voidsetWithheld(boolean synthetic)Sets or clears the is-withheld status of a vertex.StringtoString()
-
-
-
Field Detail
-
BIT_SYNTHETIC
public static final int BIT_SYNTHETIC
A bit flag indicating that the vertex is synthetic and was created through some form of mesh processing rather than being supplied as a data sample.- See Also:
- Constant Field Values
-
BIT_CONSTRAINT
public static final int BIT_CONSTRAINT
A bit flag indicating that the vertex is a member of a constraint edge.- See Also:
- Constant Field Values
-
BIT_WITHHELD
public static final int BIT_WITHHELD
A bit flag indicating that the vertex is to be treated as "withheld" and should not be processed as part of a Delaunay triangulation (TIN). This flag is used in support of data filtering and similar operations.- See Also:
- Constant Field Values
-
BIT_REFINEMENT
public static final int BIT_REFINEMENT
A bit flag indication that the vertex was created by a Delaunay refinement algorithm or other technique used to improve the quality of the triangular mesh.- See Also:
- Constant Field Values
-
x
public final double x
The Cartesian coordinate of the vertex (immutable).
-
y
public final double y
The Cartesian coordinate of the vertex (immutable).
-
status
protected byte status
The bit-mapped status flags for the vertex. The assignment of meaning to the bits for this field are defined by static members of this class.
-
reserved0
protected byte reserved0
An unused field reserved for use by applications and derived classes
-
reserved1
protected byte reserved1
An unused field reserved for use by applications and derived classes
-
auxiliary
protected byte auxiliary
The auxiliary index used for graph coloring algorithms and other applications.
-
-
Constructor Detail
-
Vertex
public Vertex(double x, double y, double z)Construct a vertex with the specified coordinates and z value. Intended for use with DataMode.Continuous. If the z value is Nan then the vertex will be treated as a "null data value"- Parameters:
x- the coordinate on the surface on which the vertex is definedy- the coordinate on the surface on which the vertex is definedz- the data value (z coordinate of the surface)
-
Vertex
public Vertex(double x, double y, double z, int index)Construct a vertex with the specified coordinates and ID value. If the z value is NaN then the vertex will be treated as a "null data value".- Parameters:
x- the coordinate on the surface on which the vertex is definedy- the coordinate on the surface on which the vertex is definedz- the data value (z coordinate of the surface)index- the ID of the vertex (intended as a diagnostic)
-
-
Method Detail
-
getLabel
public String getLabel()
Gets a string intended for labeling the vertex in images or reports. The default label is the index of the vertex preceeded by the letter S if the vertex is synthetic. Note that the index of a vertex is not necessarily unique but left to the requirements of the application that constructs it.- Returns:
- a valid, non-empty string.
-
getDistanceSq
public double getDistanceSq(Vertex v)
Get the square of the distance to the vertex.- Parameters:
v- a valid vertex- Returns:
- the square of the distance
-
getDistanceSq
public double getDistanceSq(double x, double y)Gets the square of the distance from the vertex to an arbitrary point.- Specified by:
getDistanceSqin interfaceISamplePoint- Parameters:
x- coordinate of arbitrary pointy- coordinate of arbitrary point- Returns:
- a distance in units squared
-
getDistance
public double getDistance(double x, double y)Gets the distance from the vertex to an arbitrary point.- Parameters:
x- coordinate of arbitrary pointy- coordinate of arbitrary point- Returns:
- the distance in the applicable coordinate system
-
getDistance
public double getDistance(Vertex v)
Get the distance to the vertex.- Parameters:
v- a valid vertex- Returns:
- the distance to the vertex
-
getX
public double getX()
Get the x coordinate associated with the vertex. The x coordinate is immutable and established when the vertex is constructed. it is populated whether the vertex contains a null data value (Z value or I value).- Specified by:
getXin interfaceISamplePoint- Returns:
- a valid floating point value.
-
getY
public double getY()
Get the y coordinate associated with the vertex. The y coordinate is inmmutable and established when the vertex is constructed. it is populated whether the vertex contains a null data value (Z value or I value).- Specified by:
getYin interfaceISamplePoint- Returns:
- a valid floating point value.
-
getZ
public double getZ()
Get the z value associated with the vertex. If the vertex is null, the return value for this method is Double.NaN ("not a number").- Specified by:
getZin interfaceISamplePoint- Returns:
- a floating point value or Double.NaN if z value is null.
-
isNull
public boolean isNull()
Indicates whether the vertex has been marked as having a null data value.- Returns:
- true if vertex is marked as null; otherwise, false.
-
getIndex
public int getIndex()
Gets the arbitrary index associated with the vertex. Indexes allow vertices to be associated with an array of values and are also used internally for diagnostic purposes.This method permits public readonly access to the index.
- Returns:
- an integer value.
-
setIndex
public void setIndex(int index)
Sets the arbitrary index associated with the vertex. Indexes allow vertices to be associated with an array of values and are also used internally for diagnostic purposes.- Parameters:
index- an integer value.
-
isSynthetic
public boolean isSynthetic()
Indicates whether a vertex is synthetic (was created through a Tinfour procedure rather than supplied by an application).- Returns:
- true if vertex is synthetic; otherwise, false
-
setSynthetic
public void setSynthetic(boolean synthetic)
Sets or clears the is-synthetic status of a vertex.- Parameters:
synthetic- true if vertex is synthetic; otherwise, false
-
setConstraintMember
public void setConstraintMember(boolean constraintMember)
Sets or clears the is-constraint-member status of a vertex.- Parameters:
constraintMember- true if vertex is a part of a constraint definition or lies on the border of an area constraint; otherwise, false
-
isWithheld
public boolean isWithheld()
Indicates whether a vertex is marked as withheld. This setting is typically set by application code or other utilities rather than by Tinfour internal operations.- Returns:
- true if vertex is withheld; otherwise, false
-
setWithheld
public void setWithheld(boolean synthetic)
Sets or clears the is-withheld status of a vertex.- Parameters:
synthetic- true if vertex is withheld; otherwise, false
-
setStatus
public void setStatus(int status)
Sets the status value of the vertex. This method is intended to provide an efficient way of setting multiple status flags at once.- Parameters:
status- a valid status value. Because the status is defined as a single byte, higher-order bytes will be ignored.
-
getStatus
public int getStatus()
Gets the current value of the status flags for this vertex.- Returns:
- a positive integer in the range 0 to 255.
-
isConstraintMember
public boolean isConstraintMember()
Indicates whether a vertex is part of a constraint definition or lies on the border of an area constraint.- Returns:
- true if vertex is a constraint member; otherwise, false
-
getAuxiliaryIndex
public int getAuxiliaryIndex()
Gets the auxiliary index for the vertex. The auxiliary index field is one byte in size and supports integer values in the range 0 to 255. It is used to support graph-coloring algorithms but is available for other uses as well.- Returns:
- an integer value in the range 0 to 255
-
setAuxiliaryIndex
public void setAuxiliaryIndex(int auxiliaryIndex)
Sets the auxiliary index for the vertex. The auxiliary index field is one byte in size and supports integer values in the range 0 to 255. It is used to support graph-coloring algorithms but is available for other uses as well.- Parameters:
auxiliaryIndex- a value in the range 0 to 255
-
isRefinementProduct
public boolean isRefinementProduct()
Indicates whether a vertex is a refinement product (was created through a Delaunay refinement procedure rather than supplied by an application).Note: When one of the Tinfour Incremental TIN classes performs a restore-Delaunay operation for added constraints, any artificially created vertices will be marked as "synthetic" but not as a "refinement product". The designation refinement product applies only in cases where a Delaunay refiner class creates vertices based on it own independent algorithms.
- Returns:
- true if vertex is a refinement product; otherwise, false
-
setRefinementProduct
public void setRefinementProduct(boolean refinement)
Sets or clears the is-refinement-product status of a vertex.- Parameters:
refinement- true if vertex is synthetic; otherwise, false
-
-