Package org.tinfour.common
Class Thresholds
- java.lang.Object
-
- org.tinfour.common.Thresholds
-
public class Thresholds extends Object
Provides a standard calculation of threshold values appropriate for use in an incremental TIN implementation based on nominal point spacing. With the exception of vertex tolerance, all thresholds are computed using a small multiplier times the Unit of Least Precision (ULP) computed from the nominal point spacing. The vertex tolerance is a fixed fraction of the nominal point spacing.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDELAUNAY_THRESHOLD_FACTORFactor for computing the Delaunay threshold.static doubleHALF_PLANE_THRESHOLD_FACTORFactor for computing the half-plane threshold.static doubleIN_CIRCLE_THRESHOLD_FACTORFactor for computing the in-circle threshold.static doublePRECISION_THRESHOLD_FACTORFactor for computing precision threshold.static doubleVERTEX_TOLERANCE_FACTOR_DEFAULTFactor for computing the vertex tolerance.
-
Constructor Summary
Constructors Constructor Description Thresholds()Constructs thresholds for a nominal point spacing of 1.Thresholds(double nominalPointSpacing)Constructs threshold values for the specified nominalPointSpacing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetCircumcircleDeterminantThreshold()Gets a threshold value giving guidelines for the smallest absolute value result that can be trusted in geometric calculations for for computing a determinant to be used in determining a set of circumcircle center coordinates and radius.doublegetDelaunayThreshold()Gets the computed value for evaluating whether a triangle pair is within sufficient tolerance when testing to see if they approximately meet the Delaunay criterion using the in-circle calculation.doublegetHalfPlaneThreshold()Gets a threshold value giving guidelines for the smallest absolute value result that can be trusted in geometric calculations for determining on which side of a point a plane lies (the "half-plane calculation").doublegetInCircleThreshold()Gets the threshold value indicating when an extended-precision calculation must be used for the in-circle determination.doublegetNominalPointSpacing()Gets the nominal point spacing value specified in the constructor.doublegetPrecisionThreshold()Get a threshold value giving guidelines for the smallest absolute value result from a geometric calculations that can be accepted without concern for an excessive loss of precision.doublegetVertexTolerance()Gets a threshold value indicating the distance at which a pair of (x,y) coordinates will be treated as effectively a match for a vertex.doublegetVertexTolerance2()Gets a threshold value indicating the square of the distance at which a pair of (x,y) coordinates will be treated as effectively a match for a vertex.
-
-
-
Field Detail
-
PRECISION_THRESHOLD_FACTOR
public static final double PRECISION_THRESHOLD_FACTOR
Factor for computing precision threshold.- See Also:
- Constant Field Values
-
HALF_PLANE_THRESHOLD_FACTOR
public static final double HALF_PLANE_THRESHOLD_FACTOR
Factor for computing the half-plane threshold.- See Also:
- Constant Field Values
-
DELAUNAY_THRESHOLD_FACTOR
public static final double DELAUNAY_THRESHOLD_FACTOR
Factor for computing the Delaunay threshold.- See Also:
- Constant Field Values
-
IN_CIRCLE_THRESHOLD_FACTOR
public static final double IN_CIRCLE_THRESHOLD_FACTOR
Factor for computing the in-circle threshold.- See Also:
- Constant Field Values
-
VERTEX_TOLERANCE_FACTOR_DEFAULT
public static final double VERTEX_TOLERANCE_FACTOR_DEFAULT
Factor for computing the vertex tolerance.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Thresholds
public Thresholds()
Constructs thresholds for a nominal point spacing of 1.
-
Thresholds
public Thresholds(double nominalPointSpacing)
Constructs threshold values for the specified nominalPointSpacing. In general, the nominal point spacing is a rough estimate of the mean distance between neighboring points (or vertices). It is used for estimating threshold values for logic used by the IncrementalTin and related classes. A perfect value is not necessary. An estimate within a couple orders of magnitude of the actual value is sufficient.- Parameters:
nominalPointSpacing- a positive, non-zero value
-
-
Method Detail
-
getInCircleThreshold
public double getInCircleThreshold()
Gets the threshold value indicating when an extended-precision calculation must be used for the in-circle determination.- Returns:
- a positive value scaled according to the nominal point spacing of the TIN.
-
getVertexTolerance
public double getVertexTolerance()
Gets a threshold value indicating the distance at which a pair of (x,y) coordinates will be treated as effectively a match for a vertex.- Returns:
- a distance in the system of units consistent with the TIN.
-
getVertexTolerance2
public double getVertexTolerance2()
Gets a threshold value indicating the square of the distance at which a pair of (x,y) coordinates will be treated as effectively a match for a vertex.- Returns:
- a distance squared in the system of units consistent with the TIN.
-
getPrecisionThreshold
public double getPrecisionThreshold()
Get a threshold value giving guidelines for the smallest absolute value result from a geometric calculations that can be accepted without concern for an excessive loss of precision. This value is based on general assumptions about the what constitutes a significant distance given the nominal point spacing of the vertices in the TIN.- Returns:
- a small, positive value.
-
getNominalPointSpacing
public double getNominalPointSpacing()
Gets the nominal point spacing value specified in the constructor. In general, this value is a rough estimate of the mean distance between neighboring points (or vertices).- Returns:
- a positive, non-zero value.
-
getDelaunayThreshold
public double getDelaunayThreshold()
Gets the computed value for evaluating whether a triangle pair is within sufficient tolerance when testing to see if they approximately meet the Delaunay criterion using the in-circle calculation. A positive (non-zero) in-circle value indicates that the pair violates the criterion, but for case where floating-point limitations may result in conflicts, a very small positive value may be acceptable for approximation purposes.This value is primarily used in test procedures that evaluate the correctness of a TIN constructed by the IncrementalTin class.
- Returns:
- A positive value much smaller than the nominal point spacing.
-
getHalfPlaneThreshold
public double getHalfPlaneThreshold()
Gets a threshold value giving guidelines for the smallest absolute value result that can be trusted in geometric calculations for determining on which side of a point a plane lies (the "half-plane calculation"). If the absolute value of the result is smaller than this threshold, extended-precision arithmetic is advised.- Returns:
- a positive, non-zero value much smaller than the nominal point spacing.
-
getCircumcircleDeterminantThreshold
public double getCircumcircleDeterminantThreshold()
Gets a threshold value giving guidelines for the smallest absolute value result that can be trusted in geometric calculations for for computing a determinant to be used in determining a set of circumcircle center coordinates and radius. If the absolute value of the determinant result is smaller than this threshold, extended-precision arithmetic is advised.- Returns:
- a positive, non-zero value significantly smaller than the nominal point spacing.
-
-