TriangleNet.Tools.QuadTree.QuadTree C# (CSharp) Method

QuadTree() public method

Initializes a new instance of the QuadTree class.
The quadtree does not track changes of the mesh. If a mesh is refined or changed in any other way, a new quadtree has to be built to make the point location work. A node of the tree will be split, if its level if less than the max depth parameter AND the number of triangles in the node is greater than the size bound.
public QuadTree ( Mesh mesh, int maxDepth, int sizeBound ) : System.Collections.Generic
mesh Mesh Mesh containing triangles.
maxDepth int The maximum depth of the tree.
sizeBound int The maximum number of triangles contained in a leaf.
return System.Collections.Generic
        public QuadTree(Mesh mesh, int maxDepth, int sizeBound)
        {
            this.maxDepth = maxDepth;
            this.sizeBound = sizeBound;

            triangles = mesh.Triangles.ToArray();

            int currentDepth = 0;

            root = new QuadNode(mesh.Bounds, this, true);
            root.CreateSubRegion(++currentDepth);
        }