Logo Search packages:      
Sourcecode: inkscape version File versions

Piecewise< SBasis > Geom::atan2 ( Piecewise< D2< SBasis > > const &  vect,
double  tol,
unsigned  order 

Return a function which gives the angle of vect at each point.

vect a piecewise parameteric curve.
tol the maximum error allowed.
order the maximum degree to use for approximation

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

References Geom::D2< T >::at0(), Geom::Piecewise< T >::concat(), Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::segs, Geom::Piecewise< T >::setDomain(), and Geom::Piecewise< T >::size().

    Piecewise<SBasis> result;
    Piecewise<D2<SBasis> > v = cutAtRoots(vect,tol);
    for (unsigned i=0; i<v.size(); i++){

        D2<SBasis> vi = RescaleForNonVanishingEnds(v.segs[i]);
        SBasis x=vi[0], y=vi[1];
        Piecewise<SBasis> angle;
        angle = divide (x*derivative(y)-y*derivative(x), x*x+y*y, tol, order);

        //TODO: I don't understand this - sign.
        angle = integral(-angle);
        Point vi0 = vi.at0(); 
        angle += -std::atan2(vi0[1],vi0[0]) - angle[0].at0();
        //TODO: deal with 2*pi jumps form one seg to the other...
        //TODO: not exact at t=1 because of the integral.
        //TODO: force continuity?

    return result;

Generated by  Doxygen 1.6.0   Back to index