예제 #1
0
        public void PointConvertToTest2()
        {
            Coord3d coord1 = new Coord3d(new Point3d(2, 3, 1), Matrix3d.RotationMatrix(new Vector3d(2, 1, 5), PI / 3));
            Coord3d coord2 = new Coord3d(new Point3d(1, -3, 4), Matrix3d.RotationMatrix(new Vector3d(3, 2, 1), PI / 2));

            Point3d p1 = new Point3d(1, 2, -2, coord1);
            Point3d p2 = p1.ConvertTo(coord2);

            Assert.IsTrue(p2 == p1);
        }
예제 #2
0
        public void PointProjectionToPlaneTest()
        {
            Point3d p1 = new Point3d(-4, 3, 5);
            Plane3d s1 = new Plane3d(-1, 2, -2, 9);

            Assert.IsTrue(p1.ProjectionTo(s1) == new Point3d(-3, 1, 7));

            Coord3d coord1 = new Coord3d(new Point3d(2, 3, 1), Matrix3d.RotationMatrix(new Vector3d(2, 1, 5), PI / 3));

            p1 = p1.ConvertTo(coord1);
            Assert.IsTrue(p1.ProjectionTo(s1) == new Point3d(-3, 1, 7));
        }
예제 #3
0
        public void PointProjectionToSphereTest()
        {
            Point3d p1 = new Point3d(1, 1, 1);
            Sphere  s  = new Sphere(p1, 2);
            Point3d p2 = new Point3d(5, 5, 5);

            Assert.IsTrue(p2.ProjectionTo(s) == new Point3d(1 + 2 / Sqrt(3), 1 + 2 / Sqrt(3), 1 + 2 / Sqrt(3)));

            Coord3d coord1 = new Coord3d(new Point3d(2, 3, 1), Matrix3d.RotationMatrix(new Vector3d(2, 1, 5), PI / 3));

            p2 = p2.ConvertTo(coord1);
            Assert.IsTrue(p2.ProjectionTo(s) == new Point3d(1 + 2 / Sqrt(3), 1 + 2 / Sqrt(3), 1 + 2 / Sqrt(3)));
        }
예제 #4
0
        public void PointProjectionToLineTest()
        {
            Point3d  p1 = new Point3d(-4, 3, 5);
            Point3d  p2 = new Point3d(1, -5, -1);
            Vector3d v2 = new Vector3d(-2, 3, 4);
            Line3d   l1 = new Line3d(p2, v2);

            Assert.IsTrue(p1.ProjectionTo(l1) == new Point3d(-3, 1, 7));

            Coord3d coord1 = new Coord3d(new Point3d(2, 3, 1), Matrix3d.RotationMatrix(new Vector3d(2, 1, 5), PI / 3));

            p1 = p1.ConvertTo(coord1);
            Assert.IsTrue(p1.ProjectionTo(l1) == new Point3d(-3, 1, 7));
        }
예제 #5
0
 /// <summary>
 /// Initializes line segment using two points.
 /// </summary>
 public Segment3d(Point3d p1, Point3d p2)
 {
     _p1 = p1;
     _p2 = p2.ConvertTo(p1.Coord);
 }