Logo Search packages:      
Sourcecode: inkscape version File versions

OptInterval Geom::bounds_local ( const SBasis &  sb,
const OptInterval &  i,
int  order 

Find a small interval that bounds a(t) for t in i to order order

sb sbasis function
i domain interval
order number of terms

Definition at line 131 of file sbasis-roots.cpp.

    double t0=i->min(), t1=i->max(), lo=0., hi=0.;
    for(int j = sb.size()-1; j>=order; j--) {
        double a=sb[j][0];
        double b=sb[j][1];

        double t = 0;
        if (lo<0) t = ((b-a)/lo+1)*0.5;
        if (lo>=0 || t<t0 || t>t1) {
            lo = std::min(a*(1-t0)+b*t0+lo*t0*(1-t0),a*(1-t1)+b*t1+lo*t1*(1-t1));
            lo = lerp(t, a+lo*t, b);

        if (hi>0) t = ((b-a)/hi+1)*0.5;
        if (hi<=0 || t<t0 || t>t1) {
            hi = std::max(a*(1-t0)+b*t0+hi*t0*(1-t0),a*(1-t1)+b*t1+hi*t1*(1-t1));
            hi = lerp(t, a+hi*t, b);
    Interval res = Interval(lo,hi);
    if (order>0) res*=pow(.25,order);
    return res;

Generated by  Doxygen 1.6.0   Back to index