Another approach instead of working with different max gradients is to use
the second derivatives instead of the first one. So instead of the max
gradient the max second derivative Cmax of the function has to be specified
(is there a math expression for that? curvature?). Then, if you have the
function evaluated at some point p0 with value v0 and approximated gradient
g0 (which you can do by taking a second point as it is done in normal
calculation) you place a polynom of order 2 which fits the point and the
gradient at p0 and has the curvature Cmax. You know then that there is no
root between p0 and the roots of the polynomial.
This will work well with many functions. Problems can arise with functions
that are not differentiable.
I have implemented a version that works with the second derivative for
isosurfaces in my own raytracer (written in java though). If anybody wants
I can send him/her the source code.
- Micha
--
http://objects.povworld.org - the POV-Ray Objects Collection
Post a reply to this message
|