A man is walking a dog on a leash: the man can move on one curve, the dog on the other; both may vary their speed, but backtracking is not allowed.
Thomas Devogele, Maxence Esnault, Laurent Etienne. Distance discrète de Fréchet optimisée. Spatial Analysis and Geomatics (SAGEO), Nov 2016, Nice, France. hal-02110055
for all geometries a, b: DHD(a, b) <= HD(a, b)
The approximation can be made as close as needed by densifying the input geometries.
In the limit, this value will approach the true Hausdorff distance:
DHD(A, B, densifyFactor) -> HD(A, B) as densifyFactor -> 0.0
The default approximation is exact or close enough for a large subset of useful cases.
A = LINESTRING (0 0, 100 0, 10 100, 10 100)
B = LINESTRING (0 100, 0 10, 80 10)
DHD(A, B) = 22.360679774997898
HD(A, B) ~= 47.8
Location.Exterior != Locate(p, geom)
T*F **F FF*
1 - NW | 0 - NE
-------+-------
2 - SW | 3 - SE
T = | m00 m01 m02 |
| m10 m11 m12 |
| 0 0 1 |
A coordinate P = (x, y) can be transformed to a new coordinate P' = (x', y')
by representing it as a 3x1 matrix and using matrix multiplication to compute:
| x' | = T x | x |
| y' | | y |
| 1 | | 1 |
A.compose(B) = TB x TA
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
m00, m01, m02, m10, m11, m12
| m00 m01 m02 |
| m10 m11 m12 | = m00 * m11 - m01 * m10
| 0 0 1 |
1
inverse(A) = --- x adjoint(A)
det
= 1 | m11 -m01 m01*m12-m02*m11 |
--- x | -m10 m00 -m00*m12+m10*m02 |
det | 0 0 m00*m11-m10*m01 |
= | m11/det -m01/det m01*m12-m02*m11/det |
| -m10/det m00/det -m00*m12+m10*m02/det |
| 0 0 1 |
d = sqrt(x2 + y2)
sin = x / d;
cos = x / d;
Tref = Trot(sin, cos) x Tscale(1, -1) x Trot(-sin, cos)
| cos(theta) -sin(theta) 0 | | sin(theta) cos(theta) 0 | | 0 0 1 |
| cosTheta -sinTheta 0 | | sinTheta cosTheta 0 | | 0 0 1 |
| cosTheta -sinTheta x-x*cos+y*sin | | sinTheta cosTheta y-x*sin-y*cos | | 0 0 1 |
| cosTheta -sinTheta x-x*cos+y*sin | | sinTheta cosTheta y-x*sin-y*cos | | 0 0 1 |
| xScale 0 dx | | 0 yScale dy | | 0 0 1 |
Note that a shear of (1, 1) is not equal to shear(1, 0) composed with shear(0, 1). Instead, shear(1, 1) corresponds to a mapping onto the line x = y.| 1 xShear 0 | | yShear 1 0 | | 0 0 1 |
| 1 0 dx | | 1 0 dy | | 0 0 1 |
A.compose(B) = TB x TA
A.composeBefore(B) = TA x TB
AffineTransformation[[m00, m01, m02], [m10, m11, m12]]
|x.lo| <= 0.5*ulp(x.hi)and ulp(y) means "unit in the last place of y". The basic arithmetic operations are implemented using convenient properties of IEEE-754 floating-point arithmetic.
[+|-] {digit} [ . {digit} ] [ ( e | E ) [+|-] {digit}+
R(α) : tn = { t0 + nα }, n = 1,2,3,...
When α is irrational this produces a
Low discrepancy sequence
which is more evenly distributed than random numbers.
sum = frac * this + (1 - frac) * v
num = round( num, inherentScale(num) )
dist(p1, p2) =
p1 != p2 : p1.distance(p2)
p1 == p2 : Double.MAX
dist(p, seg) =
p != seq.p1 && p != seg.p2
? seg.distance(p)
: Double.MaxValue
Also computes the values of the nearest points, if any.
2 * npts - 2
).
2 * npts - 2
).
ConformingDelaunayTriangulator cdt = new ConformingDelaunayTriangulator(sites, tolerance);
// optional
cdt.SplitPointFinder = splitPointFinder;
cdt.VertexFactory = vertexFactory;
cdt.SetConstraints(segments, new List<Vertex>(vertexMap.Values));
cdt.FormInitialDelaunay();
cdt.EnforceConstraints();
subdiv = cdt.Subdivision;
LINESTRING (1507029.9878 518325.7547, 1507022.1120341457 518332.8225183258, 1507029.9833 518325.7458, 1507029.9896965567 518325.744909031)
StreamTokenizer tokenizer = new StreamTokenizer();
tokenizer.GrabWhitespace = true;
tokenizer.Verbosity = VerbosityLevel.Debug; // just for debugging
tokenizer.TextReader = File.OpenText(fileName);
Token token;
while (tokenizer.NextToken(out token)) log.Info("Token = '{0}'", token);
StreamTokenizer tokenizer = new StreamTokenizer("some string");
ArrayList tokens = new ArrayList();
if (!tokenizer.Tokenize(tokens))
{
// error handling
}
foreach (Token t in tokens) Console.WriteLine("t = {0}", t);