NURBSCurve constructor

NURBSCurve(
  1. int degree,
  2. List<double> knots,
  3. List<Vector> controlPoints, [
  4. int? startKnot,
  5. int? endKnot,
])

Implementation

NURBSCurve(
	this.degree,
	this.knots /* array of reals */,
	List<Vector> controlPoints /* array of Vector(2|3|4) */,
  [
	int? startKnot /* index in knots */,
	int? 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(int i = 0; i < controlPoints.length; i++) {
		// ensure Vector4 for control points
		final point = controlPoints[i];
      if(point is Vector4){
        this.controlPoints.add(Vector4(point.x, point.y, point.z, point.w));
      }
      else if(point is Vector3){
        this.controlPoints.add(Vector4(point.x, point.y, point.z));
      }
      else{
        this.controlPoints.add(Vector4(point.x, point.y));
      }

	}
}