Logo Search packages:      
Sourcecode: inkscape version File versions

SBasis Geom::multiply_add ( SBasis const &  a,
SBasis const &  b,
SBasis  c 
)

Compute the pointwise product of a and b adding c (Exact)

Parameters:
a,b,c sbasis functions
Returns:
sbasis equal to a*b+c
The added term is almost free

Definition at line 256 of file sbasis.cpp.

Referenced by compose(), and multiply().

                                                                {
    if(a.isZero() || b.isZero())
        return c;
    c.resize(a.size() + b.size(), Linear(0,0));
    for(unsigned j = 0; j < b.size(); j++) {
        for(unsigned i = j; i < a.size()+j; i++) {
            double tri = b[j].tri()*a[i-j].tri();
            c[i+1/*shift*/] += Linear(-tri);
        }
    }
    for(unsigned j = 0; j < b.size(); j++) {
        for(unsigned i = j; i < a.size()+j; i++) {
            for(unsigned dim = 0; dim < 2; dim++)
                c[i][dim] += b[j][dim]*a[i-j][dim];
        }
    }
    c.normalize();
    //assert(!(0 == c.back()[0] && 0 == c.back()[1]));
    return c;
}


Generated by  Doxygen 1.6.0   Back to index