Logo Search packages:      
Sourcecode: inkscape version File versions

SBasis Geom::operator+ ( const SBasis &  a,
const SBasis &  b 
)

Compute the pointwise sum of a and b (Exact)

Parameters:
a,b sbasis functions
Returns:
sbasis equal to a+b

Definition at line 84 of file sbasis.cpp.

                                                   {
    const unsigned out_size = std::max(a.size(), b.size());
    const unsigned min_size = std::min(a.size(), b.size());
    SBasis result(out_size, Linear());

    for(unsigned i = 0; i < min_size; i++) {
        result[i] = a[i] + b[i];
    }
    for(unsigned i = min_size; i < a.size(); i++)
        result[i] = a[i];
    for(unsigned i = min_size; i < b.size(); i++)
        result[i] = b[i];

    assert(result.size() == out_size);
    return result;
}


Generated by  Doxygen 1.6.0   Back to index