NURBSCurve constructor

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

Implementation

NURBSCurve(
	degree,
	knots /* array of reals */,
	controlPoints /* array of Vector(2|3|4) */,
	startKnot /* index in knots */,
	endKnot /* index in knots */
) : super() {

	this.degree = degree;
	this.knots = knots;
	this.controlPoints = [];
	// Used by periodic NURBS to remove hidden spans
	this.startKnot = startKnot ?? 0;
	this.endKnot = endKnot ?? ( this.knots.length - 1 );

	for ( var i = 0; i < controlPoints.length; ++ i ) {

		// ensure Vector4 for control points
		var point = controlPoints[ i ];
		this.controlPoints[ i ] = new Vector4( point.x, point.y, point.z, point.w );

	}

}