示例#1
0
        public void VectorConvertToTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);

            Assert.IsTrue(new Vector3d(1, 2, 3, coord1) == new Vector3d(2, 3, 1, coord2));
        }
示例#2
0
        public void CoordSystemTest()
        {
            Coord3d c1 = new Coord3d(new Point3d(), new[] { 2.0, 0.0, 0.0 }, new[] { 1.0, 1.0, 0.0 });

            Assert.IsTrue(c1.Axes == Matrix3d.Identity());

            c1 = new Coord3d(new Point3d(), new Vector3d(2, 0, 0), new Vector3d(0, 0, 5));
            c1.RotateDeg(new Vector3d(1, 0, 0), -90);
            Assert.IsTrue(c1.Axes == Matrix3d.Identity());
        }
示例#3
0
        public void TranslatePointTest1()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();

            coord1.RotateDeg(new Vector3d(0, 0, 1), 90);
            coord1.Origin = new Point3d(1, 1, 1);

            Point3d  p1 = new Point3d(1, 2, 3, Coord3d.GlobalCS);
            Vector3d v1 = new Vector3d(1, 1, 1, coord1);

            Assert.IsTrue(p1.Translate(v1) == new Point3d(0, 3, 4));
        }
示例#4
0
        public void VectorConvertToTest2()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);

            Vector3d v1 = new Vector3d(2, 3, 4);
            Vector3d v2 = v1.ConvertTo(coord1);
            Vector3d v3 = v1.ConvertTo(coord2);

            Assert.IsTrue(v2 == v3);
        }
示例#5
0
        public void PointConvertToGlobalTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);

            Point3d p1 = new Point3d(1, 2, 3, coord1);
            Point3d p2 = new Point3d(2, 3, 1, coord2);

            p1 = p1.ConvertToGlobal();
            p2 = p2.ConvertToGlobal();

            Assert.IsTrue(p1 == p2);
        }
示例#6
0
        public void PlaneConvertIntersectionToPlaneTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord1.RotateDeg(new Vector3d(1, 1, 1), 90);
            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);


            Plane3d s1 = new Plane3d(1, 1, 1, 0, Coord3d.GlobalCS);
            Plane3d s2 = new Plane3d(1, 3, 6, 0, coord1);
            Plane3d s3 = new Plane3d(100, -1000, 1, 0, coord2);


            Assert.IsTrue((Point3d)s1.IntersectionWith(s2, s3) == new Point3d(0, 0, 0));
        }
示例#7
0
        public void LineConvertToTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);

            Point3d  p1 = new Point3d(1, 2, 3, coord1);
            Vector3d v1 = new Vector3d(0, 0, 1);
            Line3d   l1 = new Line3d(p1, v1);

            l1.Point = l1.Point.ConvertTo(coord2);
            Plane3d s1 = coord2.XZ_plane;

            s1.Point = s1.Point.ConvertTo(coord1);

            Assert.IsTrue((Point3d)l1.IntersectionWith(s1) == new Point3d(1, 2, 0));
        }
示例#8
0
        public void PlaneConvertToGlobalTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord1.RotateDeg(new Vector3d(1, 1, 1), 90);
            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);
            coord1.Origin = new Point3d(1, 1, 1);
            coord2.Origin = new Point3d(10, 2, 5);

            Plane3d s1 = new Plane3d(1, 1, 1, 0, Coord3d.GlobalCS);

            s1.Point = s1.Point.ConvertTo(coord1);
            s1.Point = s1.Point.ConvertTo(coord2);
            s1.Point = s1.Point.ConvertToGlobal();

            Assert.IsTrue(s1 == new Plane3d(1, 1, 1, 0, Coord3d.GlobalCS));
        }
示例#9
0
        public void TranslatePlaneTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord1.RotateDeg(new Vector3d(1, 2, 3), 90);
            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);
            coord1.Origin = new Point3d(1, 1, 1);
            coord2.Origin = new Point3d(10, 2, 5);

            Point3d  p1 = new Point3d(1, 2, 3, Coord3d.GlobalCS);
            Point3d  p2 = new Point3d(10, -2, 6, coord1);
            Point3d  p3 = new Point3d(-3, 5, 1, coord2);
            Vector3d v1 = new Vector3d(p1, p2);
            Vector3d v2 = new Vector3d(p2, p3);
            Vector3d v3 = new Vector3d(p3, p1);

            Plane3d s = new Plane3d(1, 2, 3, 4);

            Assert.IsTrue(s.Translate(v1).Translate(v2).Translate(v3) == s);
        }
示例#10
0
        public void PlaneIntersectionWithPlanesTest()
        {
            Coord3d coord1 = Coord3d.GlobalCS.Copy();
            Coord3d coord2 = Coord3d.GlobalCS.Copy();

            coord1.RotateDeg(new Vector3d(1, 2, 3), 90);
            coord2.RotateDeg(new Vector3d(1, 1, 1), 120);
            coord1.Origin = new Point3d(1, 1, 1);
            coord2.Origin = new Point3d(10, 2, 5);

            Plane3d s1 = new Plane3d(1, 1, 1, 0, Coord3d.GlobalCS);
            Plane3d s2 = new Plane3d(3, -2, 0, 9, Coord3d.GlobalCS);
            Plane3d s3 = new Plane3d(2, 5, 1, -2, Coord3d.GlobalCS);
            Point3d p1 = (Point3d)s1.IntersectionWith(s2, s3);

            s1.Point  = s1.Point.ConvertTo(coord2);
            s2.Normal = s2.Normal.ConvertTo(coord1).ConvertTo(coord2);
            s3.Point  = s3.Point.ConvertTo(coord2).ConvertTo(coord1);
            Point3d p2 = (Point3d)s2.IntersectionWith(s1, s3);

            Assert.IsTrue(p1 == p2);
        }