public class SemiVirtualStochasticLawsonsWalk extends Object
A good review of walk algorithms for point location is provided by Soukal, R.; Málková, Kolingerová (2012) "Walking algorithms for point location in TIN models", Computational Geoscience 16:853-869.
The randomization in this class uses a custom implementation of the XORShift Random Number Generator which was discovered by George Marsaglia in 2003. This method is faster than the java.util.Random class. While it is slower than Java's ThreadLocalRandom, that Java class has the disadvantage that there is no way to set the seed value for the random sequence. For debugging and development purposes, the Tinfour team requires that the behavior of the code be reproduced every time it is run. The sequence produced by ThreadLocalRandom is always different. The exact form used here is taken from http://www.javamex.com/tutorials/random_numbers/xorshift.shtml#.WEC2g7IrJQL The technique used here were studied extensively by Sebastiano Vigna see An experimental exploration of Marsaglia's xorshift generators, scrambled at http://vigna.di.unimi.it/ftp/papers/xorshift.pdf
Constructor and Description |
---|
SemiVirtualStochasticLawsonsWalk()
Constructs an instance with a nominal point spacing of 1.
|
SemiVirtualStochasticLawsonsWalk(double nominalPointSpacing)
Construct an instance based on the specified nominal point spacing.
|
Modifier and Type | Method and Description |
---|---|
SemiVirtualEdge |
findAnEdgeFromEnclosingTriangle(SemiVirtualEdge startingEdge,
double x,
double y) |
SemiVirtualEdge |
findAnEdgeFromEnclosingTriangleInternal(SemiVirtualEdge edge,
double x,
double y)
Search the mesh beginning at the specified edge position to find
the triangle that contains the specified coordinates.
|
void |
printDiagnostics(PrintStream ps)
Print diagnostic information about the walk behavior to output stream.
|
void |
reset()
Reset the random seed for the stochastic functions to zero.
|
public SemiVirtualStochasticLawsonsWalk(double nominalPointSpacing)
nominalPointSpacing
- a value greater than zero giving an
indication of the magnitude of the distances between vertices.public SemiVirtualStochasticLawsonsWalk()
public SemiVirtualEdge findAnEdgeFromEnclosingTriangle(SemiVirtualEdge startingEdge, double x, double y)
public SemiVirtualEdge findAnEdgeFromEnclosingTriangleInternal(SemiVirtualEdge edge, double x, double y)
The algorithm requires the initial edge to be an interior-side edge of the TIN. If necessary, the initial edge is replaced with its dual in order to ensure that this condition is met before beginning the walk.
edge
- the edge giving both the starting point of the search
and storing the ultimate destination.x
- the x coordinate of interesty
- the y coordinate of interestpublic void printDiagnostics(PrintStream ps)
ps
- a valid print stream.public void reset()
Copyright © 2021. All rights reserved.