NURBSCurve constructor

NURBSCurve(
  1. dynamic degree,
  2. dynamic knots,
  3. dynamic controlPoints,
  4. dynamic startKnot,
  5. dynamic endKnot,
)

Implementation

NURBSCurve(this.degree, this.knots /* array of reals */, controlPoints /* array of Vector(2|3|4) */,
    startKnot /* index in knots */, endKnot /* index in knots */
    )
    : super() {
  this.controlPoints = [];
  // Used by periodic NURBS to remove hidden spans
  this.startKnot = startKnot ?? 0;
  this.endKnot = endKnot ?? (knots.length - 1);

  for (var i = 0; i < controlPoints.length; ++i) {
    // ensure Vector4 for control points
    var point = controlPoints[i];
    this.controlPoints[i] = Vector4(point.x, point.y, point.z, point.w);
  }
}