Logo Search packages:      
Sourcecode: inkscape version File versions

Poly Geom::sbasis_to_poly ( SBasis const &  sb  ) 

Changes the basis of p to be monomial.

Parameters:
p the Symmetric basis polynomial
Returns:
the Monomial basis polynomial
This algorithm is horribly slow and numerically terrible. Only for testing.

Definition at line 29 of file sbasis-poly.cpp.

                                       {
    if(sb.isZero())
        return Poly();
    Poly S; // (1-x)x = -1*x^2 + 1*x + 0
    Poly A, B;
    B.push_back(0);
    B.push_back(1);
    A.push_back(1);
    A.push_back(-1);
    S = A*B;
    Poly r;
    
    for(int i = sb.size()-1; i >= 0; i--) {
        r = S*r + sb[i][0]*A + sb[i][1]*B;
    }
    r.normalize();
    return r;
}


Generated by  Doxygen 1.6.0   Back to index