ISAAR.MSolve.IGA/Postprocessing/ParaviewNurbs2D.cs
/// <summary>
/// NURBS Book Algorithm A2.2
/// Optimized Algorithm that calculates the basis functions.
/// </summary>
/// <param name="spanId"></param>
/// <param name="pointCoordinate"></param>
/// <param name="degree"></param>
/// <param name="knotValueVector"></param>
/// <returns></returns>
NURBS Book Algorithm A2.2
Optimized Algorithm that calculates the basis functions.
NURBS Book Algorithm A2 . 2 Optimized Algorithm that calculates the basis functions .
public static Vector BasisFunctions(int spanId, double pointCoordinate, int degree, Vector knotValueVector)
		{
			var basisFunctions = Vector.CreateZero(degree + 1);
			var left = Vector.CreateZero(degree + 1);
			var right = Vector.CreateZero(degree + 1);
			basisFunctions[0] = 1;
			for (int j = 1; j <= degree; j++)
			{
				left[j] = pointCoordinate - knotValueVector[spanId + 1 - j];
				right[j] = knotValueVector[spanId + j] - pointCoordinate;
				var saved = 0.0;
				for (int r = 0; r < j; r++)
				{
					var temp = basisFunctions[r] / (right[r + 1] + left[j - r]);
					basisFunctions[r] = saved + right[r + 1] * temp;
					saved = left[j - r] * temp;
				}
				basisFunctions[j] = saved;
			}
			return basisFunctions;
		}
public static Vector BasisFunctions ( int spanId , double pointCoordinate , int degree , Vector knotValueVector ) { var basisFunctions = Vector . CreateZero ( degree + 1 ) ; var left = Vector . CreateZero ( degree + 1 ) ; var right = Vector . CreateZero ( degree + 1 ) ; basisFunctions [ 0 ] = 1 ; for ( int j = 1 ; j <= degree ; j ++ ) { left [ j ] = pointCoordinate - knotValueVector [ spanId + 1 - j ] ; right [ j ] = knotValueVector [ spanId + j ] - pointCoordinate ; var saved = 0.0 ; for ( int r = 0 ; r < j ; r ++ ) { var temp = basisFunctions [ r ] / ( right [ r + 1 ] + left [ j - r ] ) ; basisFunctions [ r ] = saved + right [ r + 1 ] * temp ; saved = left [ j - r ] * temp ; } basisFunctions [ j ] = saved ; } return basisFunctions ; }
NURBS Book Algorithm A2.2
Optimized Algorithm that calculates the basis functions.
NURBS Book Algorithm A2 . 2 Optimized Algorithm that calculates the basis functions .
None
spanId
int
None
pointCoordinate
double
None
degree
int
None
knotValueVector
Vector
None