Пример #1
0
        public override bool intersects(TezShape shape)
        {
            switch (shape.category)
            {
            case Category.Point:
                return(shape.originX >= originX &&
                       shape.originY >= originY &&
                       shape.originX <= maxX &&
                       shape.originY <= maxY);

            case Category.Circle:
                return(false);

            case Category.Rectangle:
                var rect = (TezRectangle)shape;

                return(!(rect.originX > maxX ||
                         rect.originY > maxY ||
                         rect.maxX < originX ||
                         rect.maxY < originY));

            default:
                break;
            }

            return(false);
        }
Пример #2
0
        private int calculateQuadrant(TezShape shape)
        {
            bool in_left   = shape.originX <= bounds.midX;
            bool in_bottom = shape.originY <= bounds.midY;

            if (in_left)
            {
                if (in_bottom)
                {
                    return(Quadrant_3);
                }
                else
                {
                    return(Quadrant_2);
                }
            }
            else
            {
                if (in_bottom)
                {
                    return(Quadrant_4);
                }
                else
                {
                    return(Quadrant_1);
                }
            }
        }
Пример #3
0
        public override bool contains(TezShape shape)
        {
            switch (shape.category)
            {
            case Category.Point:
                return(originX == shape.originX && originY == shape.originY);

            case Category.Rectangle:
                break;

            case Category.Circle:
                break;

            default:
                break;
            }

            return(false);
        }
Пример #4
0
        private void retrieve(TezShape shape, ref List <TezQtEntry> result)
        {
            if (!bounds.intersects(shape))
            {
                return;
            }

            if (m_Objects.Count > 0)
            {
                result.AddRange(m_Objects);
            }

            if (m_IsSubdivided)
            {
                m_Nodes[Quadrant_1].retrieve(shape, ref result);
                m_Nodes[Quadrant_2].retrieve(shape, ref result);
                m_Nodes[Quadrant_3].retrieve(shape, ref result);
                m_Nodes[Quadrant_4].retrieve(shape, ref result);
            }
        }
Пример #5
0
        public override bool intersects(TezShape shape)
        {
            switch (shape.category)
            {
            case Category.Point:
                return(originX == shape.originX && originY == shape.originY);

            case Category.Rectangle:
                var rect = (TezRectangle)shape;
                return(originX >= rect.originX &&
                       originY >= rect.originY &&
                       originX <= rect.maxX &&
                       originY <= rect.maxY);

            case Category.Circle:
                break;

            default:
                break;
            }

            return(false);
        }
Пример #6
0
        public override bool contains(TezShape shape)
        {
            switch (shape.category)
            {
            case Category.Point:
                return(shape.originX >= originX &&
                       shape.originY >= originY &&
                       shape.originX <= maxX &&
                       shape.originY <= maxY);

            case Category.Circle:
                var circle = (TezCircle)shape;
                var max_x  = circle.originX + circle.radius;
                var max_y  = circle.originY + circle.radius;
                var min_x  = circle.originX - circle.radius;
                var min_y  = circle.originY - circle.radius;

                return(min_x >= originX &&
                       min_y >= originY &&
                       max_x <= maxX &&
                       max_y <= maxY);

            case Category.Rectangle:
                var rect = (TezRectangle)shape;

                return(rect.originX >= originX &&
                       rect.originY >= originY &&
                       rect.maxX <= maxX &&
                       rect.maxY <= maxY);

            default:
                break;
            }

            return(false);
        }
Пример #7
0
 public abstract bool intersects(TezShape shape);
Пример #8
0
 public abstract bool contains(TezShape shape);
Пример #9
0
 public override bool contains(TezShape circle)
 {
     return(false);
 }
Пример #10
0
 public override bool intersects(TezShape shape)
 {
     return(false);
 }