Class xlifepp::Nurbs#
-
class Nurbs : public xlifepp::Spline#
-
Inheritence diagram for xlifepp::Nurbs:
Collaboration diagram for xlifepp::Nurbs:
Nurbs class implements non uniform rational Bspline for 3D surface it is built from BSpline’s in two parameter directions (u,v), may be seen as a cross product of two BSpline it inherits from Spline class but some Spline data are not used or replaced it may deal with approximation or interpolation subtype.
When not specified, use interpolation
Public Functions
-
Nurbs(const std::vector<Point> &cpts, number_t ncpu, number_t degree_u = 3, number_t degree_v = 3, SplineBC bcs_u = _clampedBC, SplineBC bcs_v = _clampedBC, SplineBC bce_u = _undefBC, SplineBC bce_v = _undefBC, const std::vector<real_t> &w = std::vector<real_t>())#
-
constructor from control points and weights given as vectors (p11,… p1n,p21, … p2n, …, pm1,… pmn)
-
Nurbs(const std::vector<std::vector<Point>> &cpts, number_t degree_u = 3, number_t degree_v = 3, SplineBC bcs_u = _clampedBC, SplineBC bcs_v = _clampedBC, SplineBC bce_u = _undefBC, SplineBC bce_v = _undefBC, const std::vector<std::vector<real_t>> &w = std::vector<std::vector<real_t>>())#
-
constructor from control points and weights given as vectors of vectors ( (p11,… p1n), (p21, … p2n), …, (pm1,… pmn) )
-
Nurbs(SplineSubtype sbt, const std::vector<Point> &cpts, number_t ncpu, number_t degree_u = 3, number_t degree_v = 3, SplineBC bcs_u = _clampedBC, SplineBC bcs_v = _clampedBC, SplineBC bce_u = _undefBC, SplineBC bce_v = _undefBC, const std::vector<real_t> &w = std::vector<real_t>())#
-
build controlPointsM_ and weightsM_ matrices from vectors
-
Point evaluate(real_t u, real_t v, DiffOpType d = _id) const#
-
evaluate nurbs or its derivative at (u,v)
evaluate nurbs or its derivative at (u,v) Q(u,v)= sum{i=0,m} sum{j=0,n} wij Bi,k(s) Bi,k(t) Pij / sum{i=0,m} sum{j=0,n} wij Bi,k(s) Bi,k(t) with s = s0+u*(sf-s0) , t = t0+v*(tf-t0) with (s0,sf) and (t0,tf) bounds of u/v knot parameters and Bi,k B-spline functions When wij=1 for all i,j: Q(u,v)= sum{i=0,m} sum{j=0,n} Bi,k(s) Bi,k(t) Pij (not rational)
-
Vector<real_t> funParametrization(const Point &pt, Parameters &pars, DiffOpType d = _id) const#
-
parametrization
< parametrization s(t)
-
void init(number_t degree_u, number_t degree_v, SplineBC bcs_u, SplineBC bcs_v, SplineBC bce_u, SplineBC bce_v)#
-
initialize Nurbs
-
void initInterp()#
-
additional initialization when interpolated nurbs
initialization when interpolation is selected controlPointsM_ (in) : list of interpolated points Q_ij controlPointsM_ (out) : list of control points P_ij leading to nurbs interpolating Q_ij this function solve the linear system sum_i=0,m sum_j=0,n w_ij*B_i(u_k)B_j(v_l)P_ij = sum_i=0,m sum_j=0,n w_ij*B_i(u_k)B_j(v_l) Q_kl 0 <= k <= m, 0<= l <= n <=> M*P=D*Q with M_ij_kl= w_ij*B_j(u_k)B_j(v_l) D_kl = sum_i=0,m sum_j=0,n w_ij*B_i(u_k)B_j(v_l) = sum_i=0,m sum_j=0,n M_ij when w_ij=1 for all i,j (no weight) ==> M*P=Q
u_k, v_l are given by u_k = u0+r_k*(uf-u0) and v_l = v0 + s_l*(vf-v0) (u0,uf u knot bounds, v0,vf v-knot bounds) where r_k, v_l are chosen using one of the rules uniform: r_k=k/m s_l=l/n chordal: r_k = r_k-1 + |Q_k,0-Q_k-1,0|/ sum_i=1,m |Q_i,0-Q_i-1,0| , r_0 = 0 s_l = s_l-1 + |Q_0,l-Q_0,l-1|/ sum_i=1,m |Q_0,i-Q_0,i-1| , v_0 = 0 centripetal: r_k = r_k-1 + sqrt|Q_k,0-Q_k-1,0|/ sum_i=1,m sqrt|Q_i,0-Q_i-1,0| , r_0 = 0 s_l = s_l-1 + sqrt|Q_0,l-Q_0,l-1|/ sum_i=1,m sqrt|Q_0,i-Q_0,i-1| , v_0 = 0 ONLY UNIFORM IS AVAILABLE
NOTE: M is a sparse matrix because B_i(u_k) != 0 if ku-deg <= i <= ku and B_j(v_l) != 0 if kv-deg <= j <= kv (iu, iv knots index related to uk and vl) as a result M(kl)(ij) = wij B_i(u_k) B_j(v_l) !=0 for ku-deg <= i <= ku and kv-deg <= j <= kv for row k*m+l, non zero cols: (ku-deg)*m+kv-deg -> (ku-deg)*m+kv,…, (ku-deg+1)*m+kv-deg -> (ku-deg+1 )*m+kv, …ku*m+kv-deg -> ku*m+kv,
-
Vector<real_t> invParametrization(const Point &pt, Parameters &pars, DiffOpType d = _id) const#
-
inverse of parametrization
< inverse of parametrization
-
inline Point operator()(real_t u, real_t v, DiffOpType d = _id) const#
-
< evaluate nurbs or its derivative at (u,v)
-
void print(std::ostream&) const#
-
print utility
-
Nurbs(const std::vector<Point> &cpts, number_t ncpu, number_t degree_u = 3, number_t degree_v = 3, SplineBC bcs_u = _clampedBC, SplineBC bcs_v = _clampedBC, SplineBC bce_u = _undefBC, SplineBC bce_v = _undefBC, const std::vector<real_t> &w = std::vector<real_t>())#