ISAAR.MSolve.IGA/Postprocessing/ParaviewNurbs2D.cs
/// <summary>
/// NURBS Book Algorithm A2.1
/// Algorithm that performs binary search to locate the knot span
/// in which a point is located in the knot value vector
/// </summary>
/// <param name="numberOfBasisFunctions"></param>
/// <param name="degree"></param>
/// <param name="pointCoordinate"></param>
/// <param name="knotValueVector"></param>
/// <returns></returns>
NURBS Book Algorithm A2.1
Algorithm that performs binary search to locate the knot span
in which a point is located in the knot value vector
NURBS Book Algorithm A2 . 1 Algorithm that performs binary search to locate the knot span in which a point is located in the knot value vector
public static int FindSpan(int numberOfBasisFunctions, int degree, double pointCoordinate, Vector knotValueVector)
		{
			if (pointCoordinate == knotValueVector[numberOfBasisFunctions + 1]) return numberOfBasisFunctions;
			int minimum = degree;
			int maximum = numberOfBasisFunctions + 1;
			int mid = (minimum + maximum) / 2;
			while (pointCoordinate < knotValueVector[mid] || pointCoordinate >= knotValueVector[mid + 1])
			{
				if (pointCoordinate < knotValueVector[mid])
					maximum = mid;
				else
					minimum = mid;
				mid = (minimum + maximum) / 2;
			}
			return mid;
		}
public static int FindSpan ( int numberOfBasisFunctions , int degree , double pointCoordinate , Vector knotValueVector ) { if ( pointCoordinate == knotValueVector [ numberOfBasisFunctions + 1 ] ) return numberOfBasisFunctions ; int minimum = degree ; int maximum = numberOfBasisFunctions + 1 ; int mid = ( minimum + maximum ) / 2 ; while ( pointCoordinate < knotValueVector [ mid ] || pointCoordinate >= knotValueVector [ mid + 1 ] ) { if ( pointCoordinate < knotValueVector [ mid ] ) maximum = mid ; else minimum = mid ; mid = ( minimum + maximum ) / 2 ; } return mid ; }
NURBS Book Algorithm A2.1
Algorithm that performs binary search to locate the knot span
in which a point is located in the knot value vector
NURBS Book Algorithm A2 . 1 Algorithm that performs binary search to locate the knot span in which a point is located in the knot value vector
None
numberOfBasisFunctions
int
None
degree
int
None
pointCoordinate
double
None
knotValueVector
Vector
None