| 125 | } |
| 126 | |
| 127 | int LNLib::Polynomials::GetKnotSpanIndex(int degree, const std::vector<double>& knotVector, double paramT) |
| 128 | { |
| 129 | VALIDATE_ARGUMENT(degree >= 0, "degree", "Degree must be greater than or equal zero."); |
| 130 | VALIDATE_ARGUMENT(knotVector.size() > 0, "knotVector", "KnotVector size must be greater than zero."); |
| 131 | VALIDATE_ARGUMENT(ValidationUtils::IsValidKnotVector(knotVector), "knotVector", "KnotVector must be a nondecreasing sequence of real numbers."); |
| 132 | VALIDATE_ARGUMENT_RANGE(paramT, knotVector[0], knotVector[knotVector.size() - 1]); |
| 133 | |
| 134 | int n = knotVector.size() - degree - 2; |
| 135 | if (MathUtils::IsGreaterThanOrEqual(paramT, knotVector[n + 1])) |
| 136 | { |
| 137 | return n; |
| 138 | } |
| 139 | if (MathUtils::IsLessThanOrEqual(paramT, knotVector[degree])) |
| 140 | { |
| 141 | return degree; |
| 142 | } |
| 143 | |
| 144 | int low = degree; |
| 145 | int high = n + 1; |
| 146 | int mid = (low + high) / 2; |
| 147 | |
| 148 | while (paramT < knotVector[mid] || |
| 149 | paramT >= knotVector[mid + 1]) |
| 150 | { |
| 151 | if (paramT < knotVector[mid]) |
| 152 | { |
| 153 | high = mid; |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | low = mid; |
| 158 | } |
| 159 | mid = (low + high) / 2; |
| 160 | } |
| 161 | return mid; |
| 162 | } |
| 163 | |
| 164 | void LNLib::Polynomials::BasisFunctions(int spanIndex, int degree, const std::vector<double>& knotVector, double paramT, double* basisFunctions) |
| 165 | { |
nothing calls this directly
no outgoing calls
no test coverage detected