public void Test3() { List <Vector2> points = new List <Vector2> { new Vector2(0, 0), new Vector2(4, 6), new Vector2(2, 1) }; BezierSubdivision subdivision = new BezierSubdivision(points); Assert.AreEqual(0.1608, subdivision.LengthToT(2), 0.01); Assert.AreEqual(0.4568, subdivision.LengthToT(4), 0.01); Assert.AreEqual(1.1077, subdivision.LengthToT(8), 0.01); Assert.AreEqual(2.0559, subdivision.LengthToT(32), 0.01); }
public void Test4() { List <Vector2> points = new List <Vector2> { new Vector2(0, 0), new Vector2(100, 100), new Vector2(200, 0) }; BezierSubdivision subdivision = new BezierSubdivision(points); var length = new SliderPath(PathType.Bezier, points.ToArray()).Distance; var length2 = subdivision.SubdividedApproximationLength(0.25); Assert.AreEqual(length, length2, 0.001); Assert.AreEqual(0.5, subdivision.LengthToT(length / 2), 0.01); Assert.AreEqual(1, subdivision.LengthToT(length), 0.01); Assert.AreEqual(0, subdivision.LengthToT(0), 0.01); }