public class BootstrapUtility extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BootstrapUtility.BootstrapTestResult
Indicates the results of the evaluation for a set of input points.
|
Constructor and Description |
---|
BootstrapUtility(Thresholds thresholds) |
Modifier and Type | Method and Description |
---|---|
Vertex[] |
bootstrap(List<Vertex> list)
Obtain the initial three vertices for building the mesh by selecting from
the input list.
|
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.
|
public BootstrapUtility(Thresholds thresholds)
public Vertex[] bootstrap(List<Vertex> list)
list
- a valid list of input vertices.public BootstrapUtility.BootstrapTestResult testInput(List<Vertex> input, List<Vertex> output)
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.
input
- a valid listoutput
- a valid list; or a null if the calling application does not
need to know which vertices were selected.Copyright © 2021. All rights reserved.