Example #1
0
 public void Flatten3FLengthZero()
 {
     var s = new BezierSegment3F
       {
     Point1 = new Vector3F(1, 1, 2),
     ControlPoint1 = new Vector3F(1, 1, 2),
     ControlPoint2 = new Vector3F(1, 1, 2),
     Point2 = new Vector3F(1, 1, 2),
       };
       var points = new List<Vector3F>();
       s.Flatten(points, 1, 1);
       Assert.AreEqual(0, points.Count);
 }
        public void Flatten3FLengthZero()
        {
            var s = new BezierSegment3F
            {
                Point1        = new Vector3(1, 1, 2),
                ControlPoint1 = new Vector3(1, 1, 2),
                ControlPoint2 = new Vector3(1, 1, 2),
                Point2        = new Vector3(1, 1, 2),
            };
            var points = new List <Vector3>();

            s.Flatten(points, 1, 1);
            Assert.AreEqual(0, points.Count);
        }
Example #3
0
 public void Flatten3FLargeTolerance()
 {
     var s = new BezierSegment3F
       {
     Point1 = new Vector3F(1),
     ControlPoint1 = new Vector3F(2),
     ControlPoint2 = new Vector3F(3),
     Point2 = new Vector3F(4),
       };
       var points = new List<Vector3F>();
       s.Flatten(points, 1, 10);
       Assert.AreEqual(2, points.Count);
       Assert.IsTrue(points.Contains(s.Point1));
       Assert.IsTrue(points.Contains(s.Point2));
 }
        public void Flatten3FLargeTolerance()
        {
            var s = new BezierSegment3F
            {
                Point1        = new Vector3(1),
                ControlPoint1 = new Vector3(2),
                ControlPoint2 = new Vector3(3),
                Point2        = new Vector3(4),
            };
            var points = new List <Vector3>();

            s.Flatten(points, 1, 10);
            Assert.AreEqual(2, points.Count);
            Assert.IsTrue(points.Contains(s.Point1));
            Assert.IsTrue(points.Contains(s.Point2));
        }
 public void Flatten()
 {
     var s = new BezierSegment3F
       {
     Point1 = new Vector3F(1, 2, 3),
     ControlPoint1 = new Vector3F(4, 5, 6),
     ControlPoint2 = new Vector3F(7, 8, 19),
     Point2 = new Vector3F(10, 2, 12),
       };
       var points = new List<Vector3F>();
       var tolerance = 0.01f;
       s.Flatten(points, 10, tolerance);
       Assert.IsTrue(points.Contains(s.Point1));
       Assert.IsTrue(points.Contains(s.Point2));
       var curveLength = s.GetLength(0, 1, 10, tolerance);
       Assert.IsTrue(CurveHelper.GetLength(points) >= curveLength - tolerance * points.Count / 2);
       Assert.IsTrue(CurveHelper.GetLength(points) <= curveLength);
 }
Example #6
0
        public void Flatten()
        {
            var s = new BezierSegment3F
            {
                Point1        = new Vector3(1, 2, 3),
                ControlPoint1 = new Vector3(4, 5, 6),
                ControlPoint2 = new Vector3(7, 8, 19),
                Point2        = new Vector3(10, 2, 12),
            };
            var points    = new List <Vector3>();
            var tolerance = 0.01f;

            s.Flatten(points, 10, tolerance);
            Assert.IsTrue(points.Contains(s.Point1));
            Assert.IsTrue(points.Contains(s.Point2));
            var curveLength = s.GetLength(0, 1, 10, tolerance);

            Assert.IsTrue(CurveHelper.GetLength(points) >= curveLength - tolerance * points.Count / 2);
            Assert.IsTrue(CurveHelper.GetLength(points) <= curveLength);
        }