calcBSplinePoint function

dynamic calcBSplinePoint(
  1. dynamic p,
  2. dynamic U,
  3. dynamic P,
  4. dynamic u,
)

Implementation

calcBSplinePoint( p, U, P, u ) {

	var span = findSpan( p, u, U );
	var N = calcBasisFunctions( span, u, p, U );
	var C = new Vector4( 0, 0, 0, 0 );

	for ( var j = 0; j <= p; ++ j ) {

		var point = P[ span - p + j ];
		var Nj = N[ j ];
		var 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;

}