/// <summary>Creates a uniform B-spline of the given degree, automatically configuring the knot vector to be uniform</summary> /// <param name="points">The B-spline control points</param> /// <param name="degree">The degree of the curve</param> /// <param name="open">Whether or not it should be open. Open means the curve passes through its endpoints</param> public BSpline2D(Vector2[] points, int degree = 3, bool open = false) { this.points = points; this.degree = degree.AtLeast(1); this.evalBuffer = new Vector2[degree + 1]; this.knots = SplineUtils.GenerateUniformKnots(this.degree, this.points.Length, open); }
public static Nurbs2D GetUniformBSpline(Vector2[] points, int degree = 3, bool open = true) { int ptCount = points.Length; float[] knots = SplineUtils.GenerateUniformKnots(degree, ptCount, open); return(new Nurbs2D(points, knots, null, degree)); }