Logo Search packages:      
Sourcecode: inkscape version File versions

template<typename T>
Piecewise< T > Geom::lerp ( double  t,
Piecewise< T > const &  a,
Piecewise< T >  b 
) [inline]

Interpolates between a and b.

Returns:
a if t = 0, b if t = 1, or an interpolation between a and b for t in [0,1]

Definition at line 782 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::domain(), partition(), and Geom::Piecewise< T >::setDomain().

                                                                   {
    // Make sure both paths have the same number of segments and cuts at the same locations
    b.setDomain(a.domain());
    Piecewise<T> pA = partition(a, b.cuts);
    Piecewise<T> pB = partition(b, a.cuts);

    return (pA*(1-t)  +  pB*t);
}


Generated by  Doxygen 1.6.0   Back to index