Class xlifepp::Nurbs#

class Nurbs : public xlifepp::Spline#

Inheritence diagram for xlifepp::Nurbs:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="xlifepp::Nurbs" tooltip="xlifepp::Nurbs" fillcolor="#BFBFBF"] "2" [label="xlifepp::Spline" tooltip="xlifepp::Spline"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for xlifepp::Nurbs:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "25" [label="xlifepp::Collection< string_t >" tooltip="xlifepp::Collection< string_t >"] "19" [label="xlifepp::Matrix< real_t >" tooltip="xlifepp::Matrix< real_t >"] "22" [label="xlifepp::Vector< real_t >" tooltip="xlifepp::Vector< real_t >"] "33" [label="xlifepp::Vector< xlifepp::Vector< real_t > >" tooltip="xlifepp::Vector< xlifepp::Vector< real_t > >"] "42" [label="std::list< std::pair< number_t, real_t > >" tooltip="std::list< std::pair< number_t, real_t > >"] "15" [label="std::map< number_t, std::vector< number_t > >" tooltip="std::map< number_t, std::vector< number_t > >"] "13" [label="std::map< number_t, xlifepp::Geometry * >" tooltip="std::map< number_t, xlifepp::Geometry * >"] "47" [label="std::map< real_t, number_t >" tooltip="std::map< real_t, number_t >"] "41" [label="std::map< string_t, number_t >" tooltip="std::map< string_t, number_t >"] "5" [label="std::multimap< real_t, number_t >" tooltip="std::multimap< real_t, number_t >"] "43" [label="std::list< T >" tooltip="std::list< T >"] "14" [label="std::map< K, T >" tooltip="std::map< K, T >"] "6" [label="std::multimap< K, T >" tooltip="std::multimap< K, T >"] "4" [label="std::vector< T >" tooltip="std::vector< T >"] "28" [label="std::vector< T >" tooltip="std::vector< T >"] "21" [label="std::vector< K >" tooltip="std::vector< K >"] "11" [label="std::vector< RealPair >" tooltip="std::vector< RealPair >"] "24" [label="std::vector< const xlifepp::Transformation * >" tooltip="std::vector< const xlifepp::Transformation * >"] "29" [label="std::vector< number_t >" tooltip="std::vector< number_t >"] "7" [label="std::vector< real_t >" tooltip="std::vector< real_t >"] "38" [label="std::vector< std::vector< GeoNumPair > >" tooltip="std::vector< std::vector< GeoNumPair > >"] "16" [label="std::vector< std::vector< int_t > >" tooltip="std::vector< std::vector< int_t > >"] "45" [label="std::vector< std::vector< real_t > >" tooltip="std::vector< std::vector< real_t > >"] "44" [label="std::vector< std::vector< xlifepp::Point > >" tooltip="std::vector< std::vector< xlifepp::Point > >"] "26" [label="std::vector< string_t >" tooltip="std::vector< string_t >"] "37" [label="std::vector< xlifepp::GeomDomain * >" tooltip="std::vector< xlifepp::GeomDomain * >"] "36" [label="std::vector< xlifepp::GeomElement * >" tooltip="std::vector< xlifepp::GeomElement * >"] "40" [label="std::vector< xlifepp::Parameter * >" tooltip="std::vector< xlifepp::Parameter * >"] "3" [label="std::vector< xlifepp::Point >" tooltip="std::vector< xlifepp::Point >"] "30" [label="std::vector< xlifepp::Transformation * >" tooltip="std::vector< xlifepp::Transformation * >"] "34" [label="std::vector< xlifepp::Vector< real_t > >" tooltip="std::vector< xlifepp::Vector< real_t > >"] "46" [label="xlifepp::BSpline" tooltip="xlifepp::BSpline"] "10" [label="xlifepp::BoundingBox" tooltip="xlifepp::BoundingBox"] "27" [label="xlifepp::Collection< T >" tooltip="xlifepp::Collection< T >"] "17" [label="xlifepp::ExtrusionData" tooltip="xlifepp::ExtrusionData"] "32" [label="xlifepp::GeoNode" tooltip="xlifepp::GeoNode"] "9" [label="xlifepp::Geometry" tooltip="xlifepp::Geometry"] "20" [label="xlifepp::Matrix< K >" tooltip="xlifepp::Matrix< K >"] "35" [label="xlifepp::Mesh" tooltip="xlifepp::Mesh"] "12" [label="xlifepp::MinimalBox" tooltip="xlifepp::MinimalBox"] "1" [label="xlifepp::Nurbs" tooltip="xlifepp::Nurbs" fillcolor="#BFBFBF"] "39" [label="xlifepp::Parameters" tooltip="xlifepp::Parameters"] "8" [label="xlifepp::Parametrization" tooltip="xlifepp::Parametrization"] "31" [label="xlifepp::Point" tooltip="xlifepp::Point"] "2" [label="xlifepp::Spline" tooltip="xlifepp::Spline"] "18" [label="xlifepp::Transformation" tooltip="xlifepp::Transformation"] "23" [label="xlifepp::Vector< K >" tooltip="xlifepp::Vector< K >"] "25" -> "26" [dir=forward tooltip="public-inheritance"] "25" -> "27" [dir=forward tooltip="template-instance"] "19" -> "7" [dir=forward tooltip="public-inheritance"] "19" -> "20" [dir=forward tooltip="template-instance"] "22" -> "7" [dir=forward tooltip="public-inheritance"] "22" -> "23" [dir=forward tooltip="template-instance"] "33" -> "34" [dir=forward tooltip="public-inheritance"] "33" -> "23" [dir=forward tooltip="template-instance"] "42" -> "43" [dir=forward tooltip="template-instance"] "15" -> "14" [dir=forward tooltip="template-instance"] "13" -> "14" [dir=forward tooltip="template-instance"] "47" -> "14" [dir=forward tooltip="template-instance"] "41" -> "14" [dir=forward tooltip="template-instance"] "5" -> "6" [dir=forward tooltip="template-instance"] "21" -> "4" [dir=forward tooltip="template-instance"] "11" -> "4" [dir=forward tooltip="template-instance"] "24" -> "4" [dir=forward tooltip="template-instance"] "29" -> "4" [dir=forward tooltip="template-instance"] "7" -> "4" [dir=forward tooltip="template-instance"] "38" -> "4" [dir=forward tooltip="template-instance"] "16" -> "4" [dir=forward tooltip="template-instance"] "45" -> "4" [dir=forward tooltip="template-instance"] "44" -> "4" [dir=forward tooltip="template-instance"] "26" -> "4" [dir=forward tooltip="template-instance"] "37" -> "4" [dir=forward tooltip="template-instance"] "36" -> "4" [dir=forward tooltip="template-instance"] "40" -> "4" [dir=forward tooltip="template-instance"] "3" -> "4" [dir=forward tooltip="template-instance"] "30" -> "4" [dir=forward tooltip="template-instance"] "34" -> "4" [dir=forward tooltip="template-instance"] "46" -> "2" [dir=forward tooltip="public-inheritance"] "46" -> "3" [dir=forward tooltip="usage"] "46" -> "7" [dir=forward tooltip="usage"] "46" -> "47" [dir=forward tooltip="usage"] "10" -> "11" [dir=forward tooltip="usage"] "27" -> "28" [dir=forward tooltip="public-inheritance"] "17" -> "18" [dir=forward tooltip="usage"] "17" -> "25" [dir=forward tooltip="usage"] "17" -> "29" [dir=forward tooltip="usage"] "17" -> "7" [dir=forward tooltip="usage"] "17" -> "22" [dir=forward tooltip="usage"] "17" -> "30" [dir=forward tooltip="usage"] "17" -> "31" [dir=forward tooltip="usage"] "32" -> "32" [dir=forward tooltip="usage"] "32" -> "9" [dir=forward tooltip="usage"] "9" -> "10" [dir=forward tooltip="usage"] "9" -> "12" [dir=forward tooltip="usage"] "9" -> "13" [dir=forward tooltip="usage"] "9" -> "15" [dir=forward tooltip="usage"] "9" -> "16" [dir=forward tooltip="usage"] "9" -> "17" [dir=forward tooltip="usage"] "9" -> "8" [dir=forward tooltip="usage"] "9" -> "9" [dir=forward tooltip="usage"] "9" -> "32" [dir=forward tooltip="usage"] "20" -> "21" [dir=forward tooltip="public-inheritance"] "35" -> "9" [dir=forward tooltip="usage"] "35" -> "3" [dir=forward tooltip="usage"] "35" -> "36" [dir=forward tooltip="usage"] "35" -> "37" [dir=forward tooltip="usage"] "35" -> "29" [dir=forward tooltip="usage"] "35" -> "38" [dir=forward tooltip="usage"] "35" -> "35" [dir=forward tooltip="usage"] "12" -> "3" [dir=forward tooltip="usage"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "44" [dir=forward tooltip="usage"] "1" -> "45" [dir=forward tooltip="usage"] "1" -> "46" [dir=forward tooltip="usage"] "39" -> "40" [dir=forward tooltip="usage"] "39" -> "41" [dir=forward tooltip="usage"] "8" -> "9" [dir=forward tooltip="usage"] "8" -> "22" [dir=forward tooltip="usage"] "8" -> "33" [dir=forward tooltip="usage"] "8" -> "35" [dir=forward tooltip="usage"] "8" -> "39" [dir=forward tooltip="usage"] "8" -> "42" [dir=forward tooltip="usage"] "31" -> "7" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="usage"] "2" -> "5" [dir=forward tooltip="usage"] "2" -> "7" [dir=forward tooltip="usage"] "2" -> "8" [dir=forward tooltip="usage"] "18" -> "19" [dir=forward tooltip="usage"] "18" -> "22" [dir=forward tooltip="usage"] "18" -> "24" [dir=forward tooltip="usage"] "23" -> "21" [dir=forward tooltip="public-inheritance"] }

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 Nurbs&)#

copy constructor

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

inline virtual Nurbs *clone() const#

virtual copy like constructor

void copy(const Nurbs&)#

copy Nurbs data in a cleaned Nurbs (re-allocate parametrization_ pointer)

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)

Nurbs &operator=(const Nurbs&)#

assign Nurbs to current one

void print(std::ostream&) const#

print utility

inline RealPair uBounds() const#

return u-parameter bounds

inline RealPair vBounds() const#

return v-parameter bounds