Logo Search packages:      
Sourcecode: inkscape version File versions

SBasis Geom::derivative ( SBasis const &  a  ) 

Compute the derivative of a (Exact)

Parameters:
a sbasis functions
Returns:
sbasis da/dt

Definition at line 318 of file sbasis.cpp.

                                   {
    SBasis c;
    c.resize(a.size(), Linear(0,0));
    if(a.isZero())
        return c;

    for(unsigned k = 0; k < a.size()-1; k++) {
        double d = (2*k+1)*(a[k][1] - a[k][0]);
        
        c[k][0] = d + (k+1)*a[k+1][0];
        c[k][1] = d - (k+1)*a[k+1][1];
    }
    int k = a.size()-1;
    double d = (2*k+1)*(a[k][1] - a[k][0]);
    if(d == 0)
        c.pop_back();
    else {
        c[k][0] = d;
        c[k][1] = d;
    }

    return c;
}


Generated by  Doxygen 1.6.0   Back to index