public void Flatten() { var s = 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), }; var points = new List<Vector3F>(); var tolerance = 0.01f; s.Flatten(points, 10, tolerance); Assert.IsTrue(points.Contains(s.Point2)); Assert.IsTrue(points.Contains(s.Point3)); var curveLength = s.GetLength(0, 1, 10, tolerance); Assert.IsTrue(CurveHelper.GetLength(points) >= curveLength - tolerance * points.Count / 2); Assert.IsTrue(CurveHelper.GetLength(points) <= curveLength); }
public void Flatten() { var s = 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), }; var points = new List <Vector3>(); var tolerance = 0.01f; s.Flatten(points, 10, tolerance); Assert.IsTrue(points.Contains(s.Point2)); Assert.IsTrue(points.Contains(s.Point3)); var curveLength = s.GetLength(0, 1, 10, tolerance); Assert.IsTrue(CurveHelper.GetLength(points) >= curveLength - tolerance * points.Count / 2); Assert.IsTrue(CurveHelper.GetLength(points) <= curveLength); }