Class BootstrapUtility
- java.lang.Object
-
- org.tinfour.common.BootstrapUtility
-
public class BootstrapUtility extends Object
A utility for performing the part of the bootstrap operation that is common to both the standard and virtual incremental TIN implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBootstrapUtility.BootstrapTestResultIndicates the results of the evaluation for a set of input points.
-
Constructor Summary
Constructors Constructor Description BootstrapUtility()Default constructor assuming nominal point spacing of 1.0 units.BootstrapUtility(Thresholds thresholds)Recommended constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vertex[]bootstrap(List<Vertex> list)Obtain the initial three vertices for building the mesh by selecting from the input list.BootstrapUtility.BootstrapTestResulttestInput(List<Vertex> input, List<Vertex> output)Given a set of input Vertices, test to see if their (x,y) coordinates are sufficient to create a bootstrap triangle for processing.
-
-
-
Constructor Detail
-
BootstrapUtility
public BootstrapUtility()
Default constructor assuming nominal point spacing of 1.0 units.
-
BootstrapUtility
public BootstrapUtility(Thresholds thresholds)
Recommended constructor- Parameters:
thresholds- a set of threshold values used for numerically sensitive calculations.
-
-
Method Detail
-
bootstrap
public Vertex[] bootstrap(List<Vertex> list)
Obtain the initial three vertices for building the mesh by selecting from the input list. Logic is provided to attempt to identify an initial triangle with a non-trivial area (on the theory that this stipulation produces a more robust initial mesh). In the event of an unsuccessful bootstrap attempt, future attempts can be conducted as the calling application provides additional vertices.- Parameters:
list- a valid list of input vertices.- Returns:
- if successful, a valid array of the initial three vertices.
-
testInput
public BootstrapUtility.BootstrapTestResult testInput(List<Vertex> input, List<Vertex> output)
Given a set of input Vertices, test to see if their (x,y) coordinates are sufficient to create a bootstrap triangle for processing. If they are, it populates the result list with three vertices specifying a triangle. This method attempts to detect pathological cases such as all-points-coincident or all-points-collinear.This method performs a linear regression to find a line that passes through the mean (xBar,yBar) point of the collection in the direction (uX, uY) (a unit vector). If all points are collinear, then (xBar, yBar) will lie on the line. If the points are not all collinear, it detects the point that is farthest from the line (in the perpendicular direction) and uses it as the apex of the triangle. Two additional vertices are found by searching for the vertex with the maximum distances in the direction of (uX, uY) and -(uX, uY). If these three vertices form a triangle with sufficient area, the method uses them to populate the output list and returns a result of Valid.
This method will find a line through the samples in any case where the distribution of samples is wider in one direction than in any other. It will also work in the case where all samples are uniformly distributed, though it is not as consistent as in cases where a line can be fit to a data set.
- Parameters:
input- a valid listoutput- a valid list; or a null if the calling application does not need to know which vertices were selected.- Returns:
- a enumeration indicating success or the failure condition
-
-