Beispiel #1
0
 public void Flatten2FLengthZero()
 {
     var s = new BezierSegment2F
       {
     Point1 = new Vector2F(1, 1),
     ControlPoint1 = new Vector2F(1, 1),
     ControlPoint2 = new Vector2F(1, 1),
     Point2 = new Vector2F(1, 1),
       };
       var points = new List<Vector2F>();
       s.Flatten(points, 1, 1);
       Assert.AreEqual(0, points.Count);
 }
        public void Flatten2FLengthZero()
        {
            var s = new BezierSegment2F
            {
                Point1        = new Vector2F(1, 1),
                ControlPoint1 = new Vector2F(1, 1),
                ControlPoint2 = new Vector2F(1, 1),
                Point2        = new Vector2F(1, 1),
            };
            var points = new List <Vector2F>();

            s.Flatten(points, 1, 1);
            Assert.AreEqual(0, points.Count);
        }
Beispiel #3
0
 public void Flatten2FLargeTolerance()
 {
     var s = new BezierSegment2F
       {
     Point1 = new Vector2F(1, 1),
     ControlPoint1 = new Vector2F(2, 2),
     ControlPoint2 = new Vector2F(3, 3),
     Point2 = new Vector2F(4, 4),
       };
       var points = new List<Vector2F>();
       s.Flatten(points, 1, 10);
       Assert.AreEqual(2, points.Count);
       Assert.IsTrue(points.Contains(s.Point1));
       Assert.IsTrue(points.Contains(s.Point2));
 }
        public void Flatten2FLargeTolerance()
        {
            var s = new BezierSegment2F
            {
                Point1        = new Vector2F(1, 1),
                ControlPoint1 = new Vector2F(2, 2),
                ControlPoint2 = new Vector2F(3, 3),
                Point2        = new Vector2F(4, 4),
            };
            var points = new List <Vector2F>();

            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 BezierSegment2F
       {
     Point1 = new Vector2F(1, 2),
     ControlPoint1 = new Vector2F(4, 5),
     ControlPoint2 = new Vector2F(7, 8),
     Point2 = new Vector2F(10, 2),
       };
       var points = new List<Vector2F>();
       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);
 }
Beispiel #6
0
        public void Flatten()
        {
            var s = new BezierSegment2F
            {
                Point1        = new Vector2F(1, 2),
                ControlPoint1 = new Vector2F(4, 5),
                ControlPoint2 = new Vector2F(7, 8),
                Point2        = new Vector2F(10, 2),
            };
            var points    = new List <Vector2F>();
            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);
        }