Example #1
0
 public static bool Intersect(double x1, double y1, double x2, double y2, Circle cir)
 {
     Rectangle rec = new Rectangle((float)x1,
         (float)y1,
         (float)x2,
         (float)y2,
         0,
         0);
     return Intersect(rec, cir);
 }
Example #2
0
        public static bool Intersect(Rectangle rec, Circle cir)
        {
            if (rec == null || cir == null)
                throw new ArgumentNullException();

            if (rec.distance(cir.Center) == 0)
                return true;
            if (rec.distance(cir.Center) > cir.Radius)
                return false;
            return true;
        }
        private int RangeQuery(Point center, float range, Node<int> node)
        {
            Circle coverRange = new Circle(center, range);
            int resultCount = 0;

            if (Intersect(node.getMBR(), new Circle(center, range)))
            {
                if (node.isLeaf())
                {
                    resultCount = node.getEntryCount();
                }
                else
                {
                    for (int i = 0; i < node.getEntryCount(); i++)
                    {
                        int childId = node.getId(i);
                        Node<int> childNode = rtree.NodeMap[childId];
                        resultCount += RangeQuery(center, range, childNode);
                    }
                }
            }

            return resultCount;
        }