| 184 | } |
| 185 | |
| 186 | void LNLIB_POLY_all_basis_functions( |
| 187 | int span_index, |
| 188 | int degree, |
| 189 | const double* knot_vector, |
| 190 | int knot_vector_count, |
| 191 | double knot, |
| 192 | double** out_basis_functions, |
| 193 | int* out_rows, |
| 194 | int* out_cols |
| 195 | ) |
| 196 | { |
| 197 | std::vector<double> kv(knot_vector, knot_vector + knot_vector_count); |
| 198 | |
| 199 | auto result = LNLib::Polynomials::AllBasisFunctions(span_index, degree, kv, knot); |
| 200 | |
| 201 | if (result.empty()) { |
| 202 | *out_basis_functions = nullptr; |
| 203 | *out_rows = 0; |
| 204 | *out_cols = 0; |
| 205 | return; |
| 206 | } |
| 207 | |
| 208 | int rows = static_cast<int>(result.size()); |
| 209 | int cols = rows > 0 ? static_cast<int>(result[0].size()) : 0; |
| 210 | |
| 211 | for (int i = 0; i < rows; ++i) { |
| 212 | if (static_cast<int>(result[i].size()) != cols) { |
| 213 | return; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | double* flat = new(std::nothrow) double[rows * cols]; |
| 218 | if (!flat) { |
| 219 | return; |
| 220 | } |
| 221 | |
| 222 | for (int i = 0; i < rows; ++i) { |
| 223 | for (int j = 0; j < cols; ++j) { |
| 224 | flat[i * cols + j] = result[i][j]; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | *out_basis_functions = flat; |
| 229 | *out_rows = rows; |
| 230 | *out_cols = cols; |
| 231 | } |
| 232 | |
| 233 | void LNLIB_POLY_bezier_to_power_matrix( |
| 234 | int degree, |
nothing calls this directly
no outgoing calls
no test coverage detected