A Quadtree implementation optimised for triangles.
Esempio n. 1
0
 public QuadNode(BoundingBox box, QuadTree tree)
     : this(box, tree, false)
 {
 }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
 public QuadNode(BoundingBox box, QuadTree tree)
     : this(box, tree, false)
 {
 }