Namespace for helper functions used in CAD.
Functions | |
template<typename scalar_t , int dim> | |
Vec< scalar_t, dim > | evaluate_b_spline (scalar_t t, int p, const Range< Vec< scalar_t, dim >> &control_points, const Range< scalar_t > &knots, int k) |
Evaluate B-spline in one point using De Boor's algorithm - \(\mathcal{O}(d p^2)\), where \(d\) is the number of dimensions. More... | |
template<typename scalar_t , int dim> | |
Vec< scalar_t, dim > | evaluate_b_spline (scalar_t t, int p, const Range< Vec< scalar_t, dim >> &control_points, const Range< scalar_t > &knots, scalar_t epsilon=1e-10) |
Overload with binary search for position of t in knots . More... | |
template<typename scalar_t , int dim> | |
void | generate_b_spline_derivative (int p, const Range< Vec< scalar_t, dim >> &control_points, const Range< scalar_t > &knots, Range< Vec< scalar_t, dim >> &der_control_points, Range< scalar_t > &der_knots) |
Generate control points and knot vector of a B-spline that is the first derivative of the inputed B-spline. More... | |
template<typename scalar_t , int dim> | |
void | generate_b_spline_derivative_control_points (int p, const Range< Vec< scalar_t, dim >> &control_points, const Range< scalar_t > &knots, Range< Vec< scalar_t, dim >> &der_control_points) |
Generate control points of a B-spline that is the first derivative of the inputed B-spline. More... | |
template<typename scalar_t > | |
void | generate_b_spline_derivative_knots (const Range< scalar_t > &knots, Range< scalar_t > &der_knots) |
Generate knots of a B-spline that is the first derivative of the inputed B-spline. More... | |
Vec< scalar_t, dim > mm::cad_helpers::evaluate_b_spline | ( | scalar_t | t, |
int | p, | ||
const Range< Vec< scalar_t, dim >> & | control_points, | ||
const Range< scalar_t > & | knots, | ||
int | k | ||
) |
Evaluate B-spline in one point using De Boor's algorithm - \(\mathcal{O}(d p^2)\), where \(d\) is the number of dimensions.
Adds additional time complexity of \(\mathcal{O}(\log |\mathrm{knots}|)\) if k
is not given.
scalar_t | Numeric scalar type, e.g. double or float . |
dim | Space dimension. |
p | B-spline order (starting from order 0). |
t | Point of evaluation. |
control_points | Range of control points. |
knots | Knot vector. |
k | Position of t in the knot vector, such that control_points[k] <= t < control_points[k] |
t
. Definition at line 18 of file cad_helpers.hpp.
Vec< scalar_t, dim > mm::cad_helpers::evaluate_b_spline | ( | scalar_t | t, |
int | p, | ||
const Range< Vec< scalar_t, dim >> & | control_points, | ||
const Range< scalar_t > & | knots, | ||
scalar_t | epsilon = 1e-10 |
||
) |
Overload with binary search for position of t
in knots
.
If parameter is outside the domain by epsilon, translate it back to the edge of the domain.
Definition at line 44 of file cad_helpers.hpp.
void mm::cad_helpers::generate_b_spline_derivative | ( | int | p, |
const Range< Vec< scalar_t, dim >> & | control_points, | ||
const Range< scalar_t > & | knots, | ||
Range< Vec< scalar_t, dim >> & | der_control_points, | ||
Range< scalar_t > & | der_knots | ||
) |
Generate control points and knot vector of a B-spline that is the first derivative of the inputed B-spline.
Note that its degree is p - 1
.
scalar_t | Numeric scalar type, e.g. double or float . |
dim | Space dimension. |
p | B-spline order (starting from order 0). |
control_points | Range of control points. |
knots | Knot vector. |
der_control_points | Range for derivative control points. |
der_knots | Range for derivative knots. |
Definition at line 61 of file cad_helpers.hpp.
void mm::cad_helpers::generate_b_spline_derivative_control_points | ( | int | p, |
const Range< Vec< scalar_t, dim >> & | control_points, | ||
const Range< scalar_t > & | knots, | ||
Range< Vec< scalar_t, dim >> & | der_control_points | ||
) |
Generate control points of a B-spline that is the first derivative of the inputed B-spline.
Note that its degree is p - 1
.
scalar_t | Numeric scalar type, e.g. double or float . |
dim | Space dimension. |
p | B-spline order (starting from order 0). |
control_points | Range of control points. |
knots | Knot vector. |
der_control_points | Range for derivative control points. |
Definition at line 69 of file cad_helpers.hpp.
void mm::cad_helpers::generate_b_spline_derivative_knots | ( | const Range< scalar_t > & | knots, |
Range< scalar_t > & | der_knots | ||
) |
Generate knots of a B-spline that is the first derivative of the inputed B-spline.
Note that its degree is p - 1
.
scalar_t | Numeric scalar type, e.g. double or float . |
knots | Knot vector. |
der_knots | Range for derivative knots. |
Definition at line 85 of file cad_helpers.hpp.