| 152 | } |
| 153 | |
| 154 | std::vector<double> LNLib::Interpolation::AverageKnotVector(int degree, const std::vector<double>& params) |
| 155 | { |
| 156 | int n = static_cast<int>(params.size()) - 1; |
| 157 | int m = n + degree + 1; |
| 158 | std::vector<double> knotVector(m + 1, 0.0); |
| 159 | |
| 160 | for (int i = m - degree; i <= m; ++i) { |
| 161 | knotVector[i] = 1.0; |
| 162 | } |
| 163 | |
| 164 | if (n <= degree) { |
| 165 | return knotVector; |
| 166 | } |
| 167 | |
| 168 | double windowSum = 0.0; |
| 169 | for (int i = 1; i <= degree; ++i) { |
| 170 | windowSum += params[i]; |
| 171 | } |
| 172 | knotVector[degree + 1] = windowSum / static_cast<double>(degree); |
| 173 | |
| 174 | for (int j = 2; j <= n - degree; ++j) { |
| 175 | windowSum -= params[j - 1]; |
| 176 | windowSum += params[j + degree - 1]; |
| 177 | knotVector[degree + j] = windowSum / static_cast<double>(degree); |
| 178 | } |
| 179 | |
| 180 | return knotVector; |
| 181 | } |
| 182 | |
| 183 | std::vector<double> LNLib::Interpolation::ComputeKnotVector(int degree, int controlPointsCount, const std::vector<double>& params) |
| 184 | { |
nothing calls this directly
no outgoing calls
no test coverage detected