Example #1
0
        static public QuadTree <T> Build(List <Vector3> points, double minPointSpacing)
        {
            try
            {
                BoundingBox  boundingBox = BoundingBoxBuilder.CubeFromPtArray(points);
                QuadTree <T> tree        = new QuadTree <T>(boundingBox, minPointSpacing);
                foreach (Vector3 pt in points)
                {
                    T octpt = new T
                    {
                        Position = pt
                    };
                    tree.Insert(octpt);
                }

                return(tree);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        static public Octree <T> Build(List <Vector3> points, double minPointSpacing)
        {
            try
            {
                BoundingBox boundingBox = BoundingBoxBuilder.CubeFromPtArray(points);
                Octree <T>  octree      = new Octree <T>(boundingBox, minPointSpacing);
                // int index = 0;
                foreach (Vector3 pt in points)
                {
                    T octpt = new T();
                    //octpt.Index = index++;
                    octpt.Position = pt;
                    octree.Insert(octpt);
                }

                return(octree);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        static public Octree <T> Build(List <T> Points, double minPointSpacing)
        {
            try
            {
                List <Vector3> points = new List <Vector3>();
                foreach (T pt in Points)
                {
                    points.Add(pt.Position);
                }
                BoundingBox boundingBox = BoundingBoxBuilder.CubeFromPtArray(points);


                Octree <T> octree = new Octree <T>(boundingBox, minPointSpacing);

                octree.Insert(Points);

                return(octree);
            }
            catch (Exception)
            {
                throw;
            }
        }