Ejemplo n.º 1
0
        public void Subdivide()
        {
            subdividing = true;

            children[0] = new PointQuadtree <T> (
                depth + 1,
                maximumDepth,
                CalculateChildRegion((QQuadrant)0)
                );
            children[1] = new PointQuadtree <T> (
                depth + 1,
                maximumDepth,
                CalculateChildRegion((QQuadrant)1)
                );
            children[2] = new PointQuadtree <T> (
                depth + 1,
                maximumDepth,
                CalculateChildRegion((QQuadrant)2)
                );
            children[3] = new PointQuadtree <T> (
                depth + 1,
                maximumDepth,
                CalculateChildRegion((QQuadrant)3)
                );

            foreach (KeyValuePair <QVector2D, T> entry in data)
            {
                InsertInChild(entry.Key, entry.Value);
            }
            data.Clear();

            subdividing = false;
        }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!GetType().Equals(obj.GetType()))
            {
                return(false);
            }

            PointQuadtree <T> otherQuadtree = (PointQuadtree <T>)obj;

            return(data.Equals(otherQuadtree.data) &&
                   depth == otherQuadtree.depth &&
                   region.Equals(otherQuadtree.region));
        }