示例#1
0
 public static bool AreBoundsDisjoint([NotNull] IBoundedXY geometry1,
                                      double pointX, double pointY,
                                      double tolerance)
 {
     return(AreDisjoint(
                geometry1.XMin, geometry1.YMin, geometry1.XMax, geometry1.YMax,
                pointX, pointY, tolerance));
 }
示例#2
0
 public IEnumerable <KeyValuePair <int, Line3D> > FindSegments(
     IBoundedXY searchGeometry,
     double tolerance,
     bool allowIndexing        = true,
     Predicate <int> predicate = null)
 {
     return(FindSegments(searchGeometry.XMin, searchGeometry.YMin,
                         searchGeometry.XMax, searchGeometry.YMax, tolerance, allowIndexing,
                         predicate));
 }
示例#3
0
 public static bool AreBoundsEqual(
     [NotNull] IBoundedXY geometry1,
     [NotNull] IBoundedXY geometry2,
     double tolerance)
 {
     return(AreBoundsEqual(
                geometry1.XMin, geometry1.YMin, geometry1.XMax, geometry1.YMax,
                geometry2.XMin, geometry2.YMin, geometry2.XMax, geometry2.YMax,
                tolerance));
 }
        public IEnumerable <T> Search(
            double xMin, double yMin, double xMax, double yMax,
            [NotNull] IBoundedXY knownBounds, double tolerance,
            Predicate <T> predicate = null)
        {
            xMin = Math.Max(xMin, knownBounds.XMin);
            yMin = Math.Max(yMin, knownBounds.YMin);

            xMax = Math.Min(xMax, knownBounds.XMax);
            yMax = Math.Min(yMax, knownBounds.YMax);

            return(Search(xMin, yMin, xMax, yMax, tolerance, predicate));
        }
示例#5
0
        public static double EstimateOptimalGridSize(int pointCount, IBoundedXY envelopeXY)
        {
            if (pointCount == 0)
            {
                // Indexing is not necessary
                return(-1);
            }

            double geometryHeight = envelopeXY.YMax - envelopeXY.YMin;
            double geometryWidth  = envelopeXY.XMax - envelopeXY.XMin;

            // avoid division by 0
            geometryHeight = MathUtils.AreEqual(geometryHeight, 0) ? 1 : geometryHeight;
            geometryWidth  = MathUtils.AreEqual(geometryWidth, 0) ? 1 : geometryWidth;

            double pointDensity = pointCount / geometryHeight / geometryWidth;

            double pointSpacing = 1 / Math.Sqrt(pointDensity);

            return(pointSpacing * 2);
        }
示例#6
0
        public void EnlargeToInclude(IBoundedXY other)
        {
            if (other.XMin < XMin)
            {
                XMin = other.XMin;
            }

            if (other.YMin < YMin)
            {
                YMin = other.YMin;
            }

            if (other.XMax > XMax)
            {
                XMax = other.XMax;
            }

            if (other.YMax > YMax)
            {
                YMax = other.YMax;
            }
        }
示例#7
0
 public EnvelopeXY(IBoundedXY geometry) : this(geometry.XMin, geometry.YMin,
                                               geometry.XMax, geometry.YMax)
 {
 }
 public void Add(T value, IBoundedXY boundsXY)
 {
     Add(value, boundsXY.XMin, boundsXY.YMin, boundsXY.XMax, boundsXY.YMax);
 }