public static IGeometry discreteOrientedHausdorffDistanceLine(IGeometry a, IGeometry b) { var dist = new DiscreteHausdorffDistance(a, b); dist.OrientedDistance(); return a.Factory.CreateLineString(dist.Coordinates); }
public static double discreteOrientedHausdorffDistance(IGeometry a, IGeometry b) { var dist = new DiscreteHausdorffDistance(a, b); return dist.OrientedDistance(); }
///<summary> /// Checks that the furthest distance from the buffer curve to the input /// is less than the given maximum distance. /// </summary> /// <remarks> /// This uses the Oriented Hausdorff distance metric. It corresponds to finding /// the point on the buffer curve which is furthest from <i>some</i> point on the input. /// </remarks> /// <param name="input">A geometry</param> /// <param name="bufCurve">A geometry</param> /// <param name="maxDist">The maximum distance that a buffer result can be from the input</param> private void CheckMaximumDistance(IGeometry input, IGeometry bufCurve, double maxDist) { // BufferCurveMaximumDistanceFinder maxDistFinder = new BufferCurveMaximumDistanceFinder(input); // maxDistanceFound = maxDistFinder.findDistance(bufCurve); var haus = new DiscreteHausdorffDistance(bufCurve, input); haus.DensifyFraction = 0.25; _maxDistanceFound = haus.OrientedDistance(); if (_maxDistanceFound > maxDist) { _isValid = false; var pts = haus.Coordinates; _errorLocation = pts[1]; _errorIndicator = input.Factory.CreateLineString(pts); _errMsg = "Distance between buffer curve and input is too large " + "(" + _maxDistanceFound + " at " + WKTWriter.ToLineString(pts[0], pts[1]) + ")"; } }