Exemplo n.º 1
0
        public void GetTangent()
        {
            HermiteSegment3F s = new HermiteSegment3F
            {
                Point1   = new Vector3F(1, 2, 3),
                Tangent1 = (new Vector3F(10, 3, 6) - new Vector3F(1, 2, 3)) * 3,
                Tangent2 = (new Vector3F(10, 2, 12) - new Vector3F(7, 8, 19)) * 3,
                Point2   = new Vector3F(10, 2, 12),
            };

            BezierSegment3F b = new BezierSegment3F
            {
                Point1        = new Vector3F(1, 2, 3),
                ControlPoint1 = new Vector3F(10, 3, 6),
                ControlPoint2 = new Vector3F(7, 8, 19),
                Point2        = new Vector3F(10, 2, 12),
            };

            Assert.IsTrue(Vector3F.AreNumericallyEqual(s.Tangent1, s.GetTangent(0)));
            Assert.IsTrue(Vector3F.AreNumericallyEqual(s.Tangent2, s.GetTangent(1)));
            Assert.IsTrue(Vector3F.AreNumericallyEqual(b.GetTangent(0.7f), s.GetTangent(0.7f)));
        }
        public void GetTangent()
        {
            CatmullRomSegment3F c = new CatmullRomSegment3F
            {
                Point1 = new Vector3(1, 2, 3),
                Point2 = new Vector3(10, 3, 6),
                Point3 = new Vector3(7, 8, 19),
                Point4 = new Vector3(10, 2, 12),
            };

            HermiteSegment3F h = new HermiteSegment3F
            {
                Point1   = c.Point2,
                Tangent1 = (c.Point3 - c.Point1) * 0.5f,
                Tangent2 = (c.Point4 - c.Point2) * 0.5f,
                Point2   = c.Point3,
            };

            Assert.IsTrue(Vector3.AreNumericallyEqual(h.Tangent1, c.GetTangent(0)));
            Assert.IsTrue(Vector3.AreNumericallyEqual(h.Tangent2, c.GetTangent(1)));
            Assert.IsTrue(Vector3.AreNumericallyEqual(h.GetTangent(0.7f), c.GetTangent(0.7f)));
        }
Exemplo n.º 3
0
        public void GetTangent()
        {
            CardinalSegment3F c = new CardinalSegment3F
            {
                Point1  = new Vector3F(1, 2, 3),
                Point2  = new Vector3F(10, 3, 6),
                Point3  = new Vector3F(7, 8, 19),
                Point4  = new Vector3F(10, 2, 12),
                Tension = 0.3f
            };

            HermiteSegment3F h = new HermiteSegment3F
            {
                Point1   = c.Point2,
                Tangent1 = (1 - c.Tension) * (c.Point3 - c.Point1) * 0.5f,
                Tangent2 = (1 - c.Tension) * (c.Point4 - c.Point2) * 0.5f,
                Point2   = c.Point3,
            };

            Assert.IsTrue(Vector3F.AreNumericallyEqual(h.Tangent1, c.GetTangent(0)));
            Assert.IsTrue(Vector3F.AreNumericallyEqual(h.Tangent2, c.GetTangent(1)));
            Assert.IsTrue(Vector3F.AreNumericallyEqual(h.GetTangent(0.7f), c.GetTangent(0.7f)));
        }
Exemplo n.º 4
0
        public void GetTangent()
        {
            HermiteSegment3F s = new HermiteSegment3F
              {
            Point1 = new Vector3F(1, 2, 3),
            Tangent1 = (new Vector3F(10, 3, 6) - new Vector3F(1, 2, 3)) * 3,
            Tangent2 = (new Vector3F(10, 2, 12) - new Vector3F(7, 8, 19)) * 3,
            Point2 = new Vector3F(10, 2, 12),
              };

              BezierSegment3F b = new BezierSegment3F
              {
            Point1 = new Vector3F(1, 2, 3),
            ControlPoint1 = new Vector3F(10, 3, 6),
            ControlPoint2 = new Vector3F(7, 8, 19),
            Point2 = new Vector3F(10, 2, 12),
              };

              Assert.IsTrue(Vector3F.AreNumericallyEqual(s.Tangent1, s.GetTangent(0)));
              Assert.IsTrue(Vector3F.AreNumericallyEqual(s.Tangent2, s.GetTangent(1)));
              Assert.IsTrue(Vector3F.AreNumericallyEqual(b.GetTangent(0.7f), s.GetTangent(0.7f)));
        }
Exemplo n.º 5
0
        public void GetTangent()
        {
            CatmullRomSegment3F c = new CatmullRomSegment3F
              {
            Point1 = new Vector3F(1, 2, 3),
            Point2 = new Vector3F(10, 3, 6),
            Point3 = new Vector3F(7, 8, 19),
            Point4 = new Vector3F(10, 2, 12),
              };

              HermiteSegment3F h = new HermiteSegment3F
              {
            Point1 = c.Point2,
            Tangent1 = (c.Point3 - c.Point1) * 0.5f,
            Tangent2 = (c.Point4 - c.Point2) * 0.5f,
            Point2 = c.Point3,
              };

              Assert.IsTrue(Vector3F.AreNumericallyEqual(h.Tangent1, c.GetTangent(0)));
              Assert.IsTrue(Vector3F.AreNumericallyEqual(h.Tangent2, c.GetTangent(1)));
              Assert.IsTrue(Vector3F.AreNumericallyEqual(h.GetTangent(0.7f), c.GetTangent(0.7f)));
        }