Exemplo n.º 1
0
    public bool AddPoint(Point_Test point)
    {
        if (!boundary.InMe(point))
        {
            return(false);
        }

        if (pointsInQuad.Count < capacity)
        {
            pointsInQuad.Add(point);
            return(true);
        }
        else
        {
            if (!divided)
            {
                SubDevide();
            }

            for (int i = 0; i < subDividedQuads.Length; i++)
            {
                if (subDividedQuads[i].AddPoint(point))
                {
                    return(true);
                }
            }
            return(false);
        }
    }
Exemplo n.º 2
0
 public bool InMe(Point_Test point)
 {
     if (point.x > x - width && point.x < x + width && point.y > y - hight && point.y < y + hight)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 3
0
    public void AddObjectToTree(float objectPositionX, float objectPositionY, object obj)
    {
        Point_Test pointToAdd = new Point_Test(objectPositionX, objectPositionY, obj);

        rootQuad.AddPoint(pointToAdd);
    }