Logo Search packages:      
Sourcecode: inkscape version File versions

Piecewise< D2< SBasis > > Geom::arc_length_parametrization ( D2< SBasis > const &  M,
unsigned  order,
double  tol 
)

Reparameterise M to have unit speed.

Parameters:
M the Element.
tol the maximum error allowed.
order the maximum degree to use for approximation

Definition at line 401 of file sbasis-geometric.cpp.

References arcLengthSb(), compose_inverse(), Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push_cut(), Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::size().

Referenced by arc_length_parametrization().

                                      {
    Piecewise<D2<SBasis> > u;
    u.push_cut(0);

    Piecewise<SBasis> s = arcLengthSb(Piecewise<D2<SBasis> >(M),tol);
    for (unsigned i=0; i < s.size();i++){
        double t0=s.cuts[i],t1=s.cuts[i+1];
        D2<SBasis> sub_M = compose(M,Linear(t0,t1));
        D2<SBasis> sub_u;
        for (unsigned dim=0;dim<2;dim++){
            SBasis sub_s = s.segs[i];
            sub_s-=sub_s.at0();
            sub_s/=sub_s.at1();
            sub_u[dim]=compose_inverse(sub_M[dim],sub_s, order, tol);
        }
        u.push(sub_u,s(t1));
    }
    return u;
}


Generated by  Doxygen 1.6.0   Back to index