calcBSplinePoint function

Vector4 calcBSplinePoint(
  1. int p,
  2. List<double> U,
  3. List<Vector4> P,
  4. num u,
)

Implementation

Vector4 calcBSplinePoint(int p, List<double> U, List<Vector4> P, num u ) {
	final span = findSpan( p, u, U );
	final N = calcBasisFunctions( span, u, p, U );
	final C = Vector4( 0, 0, 0, 0 );

	for (int j = 0; j <= p; j++) {
		final point = P[ span - p + j ];
		final nj = N[ j ];
		final wNj = point.w * nj;
		C.x += point.x * wNj;
		C.y += point.y * wNj;
		C.z += point.z * wNj;
		C.w += point.w * nj;
	}

	return C;
}