public static double Distance(Geometry g1, Geometry g2) { if (_cacheGeom != g1) { _fastDistanceOp = new IndexedFacetDistance(g1); _cacheGeom = g1; } return(_fastDistanceOp.Distance(g2)); }
/// <summary> /// Sets the area boundary as the convex hull /// of the obstacles. /// </summary> private void SetBoundary(Geometry obstacles) { // TODO: allow this to be set by client as arbitrary polygon this._boundary = obstacles.ConvexHull(); // if boundary does not enclose an area cannot create a ptLocater if (_boundary.Dimension >= Dimension.Surface) { _ptLocater = new IndexedPointInAreaLocator(_boundary); _boundaryDistance = new IndexedFacetDistance(_boundary); } }
/// <summary> /// Creates a new instance of a Largest Empty Circle construction. /// </summary> /// <param name="obstacles">A geometry representing the obstacles (points and lines)</param> /// <param name="tolerance">The distance tolerance for computing the center point</param> public LargestEmptyCircle(Geometry obstacles, double tolerance) { if (obstacles.IsEmpty) { throw new ArgumentException("Empty obstacles geometry is not supported"); } _obstacles = obstacles; _factory = obstacles.Factory; _tolerance = tolerance; _obstacleDistance = new IndexedFacetDistance(obstacles); SetBoundary(obstacles); }
public static Geometry NearestPointsIndexedAll(Geometry a, Geometry b) { var ifd = new IndexedFacetDistance(a); int n = b.NumGeometries; var lines = new LineString[n]; for (int i = 0; i < n; i++) { var pts = ifd.NearestPoints(b.GetGeometryN(i)); lines[i] = a.Factory.CreateLineString(pts); } return(a.Factory.CreateMultiLineString(lines)); }
/// <summary> /// Creates a new instance of a Maximum Inscribed Circle computation. /// </summary> /// <param name="polygonal">An areal geometry</param> /// <param name="tolerance">The distance tolerance for computing the centre point</param> public MaximumInscribedCircle(Geometry polygonal, double tolerance) { if (!(polygonal is IPolygonal)) { throw new ArgumentException("Input geometry must be a Polygon or MultiPolygon"); } if (polygonal.IsEmpty) { throw new ArgumentException("Empty input geometry is not supported"); } _inputGeom = polygonal; _factory = polygonal.Factory; _tolerance = tolerance; _ptLocater = new IndexedPointInAreaLocator(polygonal); _indexedDistance = new IndexedFacetDistance(polygonal.Boundary); }
private static void ComputeDistance(Geometry[] pts, Geometry geom) { IndexedFacetDistance bbd = null; if (USE_INDEXED_DIST) { bbd = new IndexedFacetDistance(geom); } for (int i = 0; i < pts.Length; i++) { if (USE_INDEXED_DIST) { double dist = bbd.Distance(pts[i]); // double dist = bbd.getDistanceWithin(pts[i].getCoordinate(), 100000); } else { double dist = geom.Distance(pts[i]); } } }
public static Geometry withinDistanceIndexed(Geometry a, Geometry mask, double maximumDistance) { var indexedDist = new IndexedFacetDistance(mask); return(Select(a, t => indexedDist.IsWithinDistance(t, maximumDistance))); }
public void RunIndexedLinePoint() { double dist = IndexedFacetDistance.Distance(geom1, pt2); }
public void RunIndexedLines() { double dist = IndexedFacetDistance.Distance(geom1, geom2); }
protected override Coordinate[] NearestPoints(Geometry g1, Geometry g2) { return(IndexedFacetDistance.NearestPoints(g1, g2)); }
protected override bool IsWithinDistance(Geometry g1, Geometry g2, double distance) { return(IndexedFacetDistance.IsWithinDistance(g1, g2, distance)); }
protected override double Distance(Geometry g1, Geometry g2) { return(IndexedFacetDistance.Distance(g1, g2)); }
public static Geometry NearestPointsIndexed(Geometry a, Geometry b) { var pts = IndexedFacetDistance.NearestPoints(a, b); return(a.Factory.CreateLineString(pts)); }
public static double DistanceIndexed(Geometry a, Geometry b) { return(IndexedFacetDistance.Distance(a, b)); }
private static void ComputeDistance(IGeometry[] pts, IGeometry geom) { IndexedFacetDistance bbd = null; if (USE_INDEXED_DIST) bbd = new IndexedFacetDistance(geom); for (int i = 0; i < pts.Length; i++) { if (USE_INDEXED_DIST) { double dist = bbd.GetDistance(pts[i]); // double dist = bbd.getDistanceWithin(pts[i].getCoordinate(), 100000); } else { double dist = geom.Distance(pts[i]); } } }