public static Surface2D <T> Build(List <Vector3> Points, double meshSize)
        {
            var boundingBox = BoundingBoxBuilder.FromPtArray(Points.ToArray());
            var surface     = new Surface2D <T>(boundingBox, meshSize);

            return(surface);
        }
示例#2
0
        private void getExtents()
        {
            List <Vector3> points = new List <Vector3>();

            foreach (SurfacePoint sp in this)
            {
                points.Add(sp.Position);
            }
            _boundingBox = BoundingBoxBuilder.FromPtArray(points.ToArray());
        }
示例#3
0
        void getBoundingBox()
        {
            var points = new List <Vector3>();

            foreach (Triangle tri in this)
            {
                points.AddRange(tri.Vertices);
            }
            boundingBox = BoundingBoxBuilder.FromPtArray(points.ToArray());
        }
示例#4
0
        public void BoundingBoxB_buildfromPts_returnsCorrectVals()
        {
            Vector3[] ptArray = new Vector3[3];
            ptArray[0] = new Vector3(-1, -2, -3);
            ptArray[1] = new Vector3(4, -4, 4);
            ptArray[2] = new Vector3(1, 2, 3);
            BoundingBox ext = BoundingBoxBuilder.FromPtArray(ptArray);

            Assert.AreEqual(4d, ext.Max.X);
            Assert.AreEqual(-4d, ext.Min.Y);
            Assert.AreEqual(4d, ext.Max.Z);
        }
示例#5
0
        public BoundingBox getBoundingBox(ToolPath5Axis inputPath)
        {
            var pointList = new List <Vector3>();

            foreach (PathEntity5Axis ent in inputPath)
            {
                pointList.Add(new Vector3(ent.Position.X, ent.Position.Y, ent.Position.Z));
            }

            BoundingBox ext = BoundingBoxBuilder.FromPtArray(pointList.ToArray());

            return(ext);
        }
示例#6
0
        public void BoundingBoxB_union_returnsCorrectVals()
        {
            Vector3[] ptArray = new Vector3[3];
            ptArray[0] = new Vector3(-1, -2, -3);
            ptArray[1] = new Vector3(4, -4, 4);
            ptArray[2] = new Vector3(1, 2, 3);
            Vector3[] ptArray2 = new Vector3[3];
            ptArray2[0] = new Vector3(4, 5, -3);
            ptArray2[1] = new Vector3(4, -4, 6);
            ptArray2[2] = new Vector3(-8, 2, 3);
            BoundingBox ext1 = BoundingBoxBuilder.FromPtArray(ptArray);
            BoundingBox ext2 = BoundingBoxBuilder.FromPtArray(ptArray2);
            BoundingBox ext  = BoundingBoxBuilder.Union(ext1, ext2);

            Assert.AreEqual(-8d, ext.Min.X);
            Assert.AreEqual(4d, ext.Max.X);
            Assert.AreEqual(5d, ext.Max.Y);
        }
示例#7
0
        public void triangle_asPointGrid_gridOK()
        {
            var v0 = new Vector3(2, 1, 0);
            var v1 = new Vector3(4, 2, 0);
            var v2 = new Vector3(2, 4, 0);

            Triangle        tri          = new Triangle(v0, v1, v2);
            List <IVector3> points       = tri.AsPointGrid(.1);
            bool            areContained = false;

            foreach (IVector3 pt in points)
            {
                areContained = tri.Contains(pt);
                Assert.IsTrue(areContained);
            }
            IBoundingBox bb = BoundingBoxBuilder.FromPtArray(points.ToArray());

            Assert.AreEqual(4.0, bb.Max.X, .001);
            Assert.AreEqual(1.0, bb.Min.Y, .001);
            Assert.AreEqual(4.0, bb.Max.Y, .001);
            Assert.IsTrue(areContained);
        }
示例#8
0
        public void triangle_asPointGrid_countOK()
        {
            var v0 = new Vector3(5, 0, 0);
            var v1 = new Vector3(0, 5, 0);
            var v2 = new Vector3(5, 5, 0);

            Triangle       tri          = new Triangle(v0, v1, v2);
            List <Vector3> points       = tri.AsPointGrid(.1);
            bool           areContained = false;

            foreach (Vector3 pt in points)
            {
                areContained = tri.Contains(pt);
                Assert.IsTrue(areContained);
            }
            BoundingBox bb = BoundingBoxBuilder.FromPtArray(points.ToArray());

            Assert.AreEqual(1300, points.Count, 40);
            Assert.AreEqual(5.0, bb.Max.X, .001);
            Assert.AreEqual(0.0, bb.Min.Y, .001);
            Assert.AreEqual(5.0, bb.Max.Y, .001);
            Assert.IsTrue(areContained);
        }
 private void getBoundingBox()
 {
     boundingBox = BoundingBoxBuilder.FromPtArray(new Vector3[] { Vert0, Vert1, Vert2 });
 }