public virtual NurbsBase Reverse() { List <Point4> controlPts = new List <Point4>(ControlPoints); controlPts.Reverse(); KnotVector knots = KnotVector.Reverse(Knots); return(new NurbsCurve(Degree, knots, controlPts)); }
public void It_Reverses_A_Knot_Vectors() { // Assert KnotVector knotVector = new KnotVector { 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3.3, 4, 4, 4 }; KnotVector expectedKnotVector = new KnotVector { 0, 0, 0, 0.7000000000000002, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4 }; // Act KnotVector reversedKnots = KnotVector.Reverse(knotVector); // Arrange reversedKnots.Should().BeEquivalentTo(expectedKnotVector); }
public NurbsBase ClampEnds() { List <Point4> evalPts = new List <Point4>(ControlPoints); KnotVector clampedKnots = new KnotVector(Knots); int j = 2; while (j-- > 0) { Evaluate.Curve.DeBoor(ref evalPts, clampedKnots, Degree, clampedKnots[Degree]); for (int i = 0; i < Degree; i++) { clampedKnots[i] = clampedKnots[Degree]; } evalPts.Reverse(); clampedKnots.Reverse(); } return(new NurbsCurve(Degree, clampedKnots, evalPts)); }