Class xlifepp::BSpline#
-
class BSpline : public xlifepp::Spline#
-
BSpline class (rational B-Spline)
Public Functions
-
BSpline(const std::vector<Point> &cpts, number_t degree = 3, SplineBC bcs = _undefBC, SplineBC bce = _undefBC, const std::vector<real_t> &weights = std::vector<real_t>())#
-
create B-Spline approximation
approximation or interpolation B-spline
-
BSpline(SplineSubtype sbt, const std::vector<Point> &cpts, number_t degree = 3, SplineParametrization spar = _uniformParametrization, SplineBC bcs = _undefBC, SplineBC bce = _undefBC, const std::vector<real_t> &yp0 = std::vector<real_t>(), const std::vector<real_t> &yp1 = std::vector<real_t>(), const std::vector<real_t> &weights = std::vector<real_t>())#
-
create Bspline approximation or interpolation
-
void computeB(real_t t, DiffOpType dif, number_t &j, Vector<real_t> &B, Vector<real_t> &dB, Vector<real_t> &d2B) const#
-
compute tool called by evaluate
-
void copy(const BSpline&)#
-
copy BSpline data in a cleaned BSpline (re-allocate parametrization_ pointer)
-
virtual Point evaluate(real_t t, DiffOpType d = _id) const#
-
evaluate spline or its derivative at t
evaluate B-Spline using Bernstein polynomials Q(s)= sum_{i=0,n} wi Bi,k(t) Pi /sum_{i=0,n} wi Bi,k(t) with t=t0_+s*(tf_-t0_) with Bi,k the B-spline function NEW VERSION: separate the computation of B from the construction of Q computeB may be reused, probably a little less efficient BSpline parameter t in [0,1] derivative order up to 2
-
virtual Point evaluate2(real_t t, DiffOpType d = _id) const#
-
evaluate spline or its derivative at t
evaluate B-Spline using Bernstein polynomials Q(s)= sum_{i=0,n} wi Bi,k(t) Pi(t) /sum_{i=0,n} wi Bi,k(t) with Bi,k the B-spline function OLD version
-
Vector<real_t> funParametrization(const Point &pt, Parameters &pars, DiffOpType d = _id) const#
-
parametrization
< parametrization s(t)
-
void initInterp()#
-
initialization when interpolation is selected cpts (in) : list of interpolated points Q_i cpts (out) : list of control points P_j leading to B-spline interpolating Q_i this function solve the linear system sum_j=0,m w_j*B_jk(s_i)P_j = sum_j=0,m w_j*B_jk(s_i) Q_i 0 <= i,j <=m <=> M*P=D*Q with M_ij = w_j*B_jk(s_i) D_ii = sum_j=0,m w_j*B_jk(s_i) =sum_j=0,m M_ij when B-spline is clamped at ends, first (resp.
last) two rows of system have to be modified P0 = Q0 k*w_m/w_m-1(t_m+1-t_m)*(Pm-Pm-1) = ype k*w_1/w_0(t_k+1-t_k)*(P1-P0) = yps Pm=Qm s_i is given by t(r_i)=t0+r_i*(tf-t0) where r_i are chosen using one of the rules uniform: r_i=i/m chordal: r_i=r_i-1 + |Q_i-Q_i-1|/ sum_j=1,m |Q_j-Q_i-j| , r_0=0 centripetal: r_i=r_i-1 + sqrt(|Q_i-Q_i-1|)/ sum_j=1,m sqrt(|Q_j-Q_i-j|) , r_0=0 with clamped conditions, the rows of the virtual end points are replaced by the derivative conditions, the row i is related to the interpolated point i-1 when the start is clamped (i otherwise) periodic condition: cyclic system on the M distinct points (control points P_M+k=P_k), see initInterpPeriodic
-
void initInterpPeriodic()#
-
interpolation with periodic condition
interpolation with periodic condition: control points P_0,…,P_M-1 (P_M+k=P_k) such that sum_c w_c B_c(s_j) P_(c mod M) = sum_c w_c B_c(s_j) Q_j j=0,…,M-1 (cyclic linear system) with s_j=t0+r_j(tf-t0), r_j=j/M (uniform) or chordal/centripetal parameters on the closed polygon data (init has been done): controlPoints_ = Q_0,…,Q_M-1,Q_0,Q_1,…,Q_degree-1 and periodic knots
-
Vector<real_t> invParametrization(const Point &pt, Parameters &pars, DiffOpType d = _id) const#
-
inverse of parametrization
< inverse of parametrization
-
std::vector<real_t> nonUniformParameters(const std::vector<Point> &Q, bool closed)#
-
chordal/centripetal parameters of points
parameters r_j in [0,1] of points Q_0,…,Q_n for chordal or centripetal parametrization (empty vector otherwise) closed=true: the closing chord Q_n -> Q_0 is included and r_j is given for j=0,…,n (r_0=0, r_n<1) also fills paramMap_ (r_j -> j)
-
virtual void print(std::ostream&, bool nocpt = false) const#
-
print utility
-
inline real_t toKnotsParameter(real_t t) const#
-
map t in [0,1] to knots parameter
-
BSpline(const std::vector<Point> &cpts, number_t degree = 3, SplineBC bcs = _undefBC, SplineBC bce = _undefBC, const std::vector<real_t> &weights = std::vector<real_t>())#