| 181 | } |
| 182 | |
| 183 | std::vector<double> LNLib::Interpolation::ComputeKnotVector(int degree, int controlPointsCount, const std::vector<double>& params) |
| 184 | { |
| 185 | int m = params.size() - 1; |
| 186 | int n = controlPointsCount - 1; |
| 187 | int nn = n + degree + 2; |
| 188 | |
| 189 | std::vector<double> knotVector(nn, 0.0); |
| 190 | double d = (double)(m + 1) / (double)(n - degree + 1); |
| 191 | for (int j = 1; j <= n - degree; j++) |
| 192 | { |
| 193 | int i = floor(j * d); |
| 194 | double alpha = (j * d) - i; |
| 195 | knotVector[degree + j] = (1.0 - alpha) * params[i - 1] + (alpha * params[i]); |
| 196 | } |
| 197 | for (int i = 0; i < nn; i++) |
| 198 | { |
| 199 | if (i <= degree) |
| 200 | { |
| 201 | knotVector[i] = 0.0; |
| 202 | } |
| 203 | else if (i >= nn - 1 - degree) |
| 204 | { |
| 205 | knotVector[i] = 1.0; |
| 206 | } |
| 207 | } |
| 208 | return knotVector; |
| 209 | } |
| 210 | |
| 211 | bool LNLib::Interpolation::ComputerWeightForRationalQuadraticInterpolation(const XYZ& startPoint, const XYZ& middleControlPoint, const XYZ& endPoint, double& weight) |
| 212 | { |
nothing calls this directly
no outgoing calls
no test coverage detected