Beispiel #1
0
        private BoundingRectangle getMinBoundingQuad(BoundingRectangle rectangle)
        {
            ICoordinate center      = rectangle.Center();
            double      maxHalfSize = Math.Max(rectangle.Width, rectangle.Height) / 2;

            BoundingRectangle result =
                new BoundingRectangle(center.X - maxHalfSize, center.Y - maxHalfSize,
                                      center.X + maxHalfSize, center.Y + maxHalfSize);

            result.Join(rectangle);
            return(result);
        }
Beispiel #2
0
            private bool canAddingToChildCell(BoundingRectangle rectangle)
            {
                ICoordinate center = _fullRectangle.Center();

                if (rectangle.ContainsPoint(center))
                {
                    return(false);
                }

                if (rectangle.MinY > center.Y)
                {
                    if (rectangle.MinX < center.X && rectangle.MaxX > center.X)
                    {
                        return(false);
                    }

                    return(true);
                }

                if (rectangle.MinX > center.X)
                {
                    if (rectangle.MinY < center.Y && rectangle.MaxY > center.Y)
                    {
                        return(false);
                    }

                    return(true);
                }

                if (rectangle.MaxY < center.Y)
                {
                    if (rectangle.MinX < center.X && rectangle.MaxX > center.X)
                    {
                        return(false);
                    }

                    return(true);
                }

                if (rectangle.MaxX < center.X)
                {
                    if (rectangle.MinY < center.Y && rectangle.MaxY > center.Y)
                    {
                        return(false);
                    }

                    return(true);
                }

                return(false);
            }
Beispiel #3
0
 private void splitY(BoundingRectangle box, out BoundingRectangle box1, out BoundingRectangle box2)
 {
     // разбиваем вдоль оси Y
     box1 = new BoundingRectangle(box.MinX, box.MinY, box.Center().X, box.MaxY);
     box2 = new BoundingRectangle(box.Center().X, box.MinY, box.MaxX, box.MaxY);
 }