sbasis-2d.cpp revision 76addc201c409e81eaaa73fe27cc0f79c4db097c
namespace Geom{
double s = u*(1-u);
double sk = 1;
sk *= s;
}
}
return sb;
}
double s = v*(1-v);
double sk = 1;
sk *= s;
}
}
return sb;
}
}
SBasis B;
SBasis s[2];
ss[0] *= s[0];
}
}
return B;
}
}
for(unsigned i = 0; i < f.size(); i++) {
}
for(unsigned i = 0; i < f.us; i++) {
for(unsigned j = 0; j < f.vs; j++) {
Linear2d dlin(lin[1+dim]-lin[0], lin[1+2*dim]-lin[dim], lin[3-dim]-lin[2*(1-dim)], lin[3]-lin[2-dim]);
if (di>=1){
Linear2d ds_lin_hi( lin[1+dim]-lin[0], lin[1+2*dim]-lin[dim], lin[3]-lin[2-dim], lin[3-dim]-lin[2-dim] );
}
}
}
return result;
}
/**
* Finds a path which traces the 0 contour of f, traversing from A to B as a single d2<sbasis>.
* degmax specifies the degree (degree = 2*degmax-1, so a degmax of 2 generates a cubic fit).
* The algorithm is based on dividing out derivatives at each end point and does not use the curvature for fitting.
* It is less accurate than sb2d_cubic_solve, although this may be fixed in the future.
*/
//g_warning("check f(A)= %f = f(B) = %f =0!", f.apply(A[X],A[Y]), f.apply(B[X],B[Y]));
double fact_k=1;
double sign = 1.;
for(unsigned k=1; k<degmax; k++){
// these two lines make the solutions worse!
//fact_k *= k;
//sign = -sign;
//sign *= 3;
}
return result;
}
/**
* Finds a path which traces the 0 contour of f, traversing from A to B as a single cubic d2<sbasis>.
* The algorithm is based on matching direction and curvature at each end point.
*/
//TODO: handle the case when B is "behind" A for the natural orientation of the level set.
//TODO: more generally, there might be up to 4 solutions. Choose the best one!
//g_warning("check 0 = %f = %f!", f.apply(A[X],A[Y]), f.apply(B[X],B[Y]));
if (candidates.empty()) {
}
//TODO: I'm sure std algorithm could do that for me...
double error = -1;
unsigned best = 0;
for (unsigned i=0; i<candidates.size(); i++){
double new_error = (fabs(bounds.max())>fabs(bounds.min()) ? fabs(bounds.max()) : fabs(bounds.min()) );
best = i;
}
}
return candidates[best];
}
};
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :