A Quadtree implementation optimised for triangles.
Ejemplo n.º 1
0
        public QuadNode(BoundingBox box, QuadTree tree, bool init)
        {
            this.tree = tree;

            this.bounds = new BoundingBox(box.Xmin, box.Ymin, box.Xmax, box.Ymax);
            this.pivot = new Point((box.Xmin + box.Xmax) / 2, (box.Ymin + box.Ymax) / 2);

            this.bitRegions = 0;

            this.regions = new QuadNode[4];
            this.triangles = new List<int>();

            if (init)
            {
                // Allocate memory upfront
                triangles.Capacity = tree.triangles.Length;

                foreach (var tri in tree.triangles)
                {
                    triangles.Add(tri.ID);
                }
            }
        }
Ejemplo n.º 2
0
 public QuadNode(BoundingBox box, QuadTree tree)
     : this(box, tree, false)
 {
 }