|
|
I think it would be a good idea to mention that the new cubic_spline
requires an extra control point at each end.
The natural_spline, quadratic_spline and linear_spline don't require
these extra control points.
Old scenes that used the whole length of an old cubic_spline have a
tendency to explode when they reach the final point, because the of the
new cubic_spline at the final control point has a tendency to evaluate
to <-1.#IND00,-1.#IND00,-1.#IND00>.
In this example scene, when using the whole length of a cubic_spline
(it's tricky to stop at the penultimate control point when using spline
functions to generate isosurfaces), the isosurface that uses the spline
explodes, and the spline evaluates to <-1.#IND00,-1.#IND00,-1.#IND00> at
the endpoint. Replace "cubic_spline" by any other spline type and the
isosurface behaves normally, and the spline evaluates to <0,0,-0.6>.
camera {
location <4, 0, -5>
look_at <0, 0.25, 0>
angle 25
}
background {rgb 1}
light_source {<100,200,-100> colour rgb 1.5}
#declare S = function {
spline {
cubic_spline
-1, < 0, 0.5, 0.0>,
-0.5, < 0, 0.2, 0.4>,
0.01, < 0, 0.2, 0.2>,
0.5, < 0, 0.4, 0.4>,
1, < 0, 0.0,-0.6>
}
}
isosurface {
function { (y - S(x).y)^2 + (z - S(x).z)^2 - 0.05 }
max_gradient 4
contained_by{box{-1,1}} open
pigment {rgb x}
}
#declare ctr = 1;
#debug concat("\n<"str(S(ctr).x,5,-1), ", "
str(S(ctr).y,5,-1), ", "
str(S(ctr).z,5,-1), ">\n\n"
)
Post a reply to this message
|
|
|
|
Mike Williams wrote in message ...
>In this example scene, when using the whole length of a cubic_spline
>(it's tricky to stop at the penultimate control point when using spline
>functions to generate isosurfaces), the isosurface that uses the spline
>explodes, and the spline evaluates to <-1.#IND00,-1.#IND00,-1.#IND00> at
>the endpoint. Replace "cubic_spline" by any other spline type and the
>isosurface behaves normally, and the spline evaluates to <0,0,-0.6>.
It shouldn't be doing that. It should be evaluating to <0, 0.4, 0.4> at any
point beyond the next-to-last. I'll see if I can find the bug.
--
Mark
Post a reply to this message
|
|
|
|
Mark Wagner wrote in message <3c88426c@news.povray.org>...
>Mike Williams wrote in message ...
>>In this example scene, when using the whole length of a cubic_spline
>>(it's tricky to stop at the penultimate control point when using spline
>>functions to generate isosurfaces), the isosurface that uses the spline
>>explodes, and the spline evaluates to <-1.#IND00,-1.#IND00,-1.#IND00> at
>>the endpoint. Replace "cubic_spline" by any other spline type and the
>>isosurface behaves normally, and the spline evaluates to <0,0,-0.6>.
>
>It shouldn't be doing that. It should be evaluating to <0, 0.4, 0.4> at
any
>point beyond the next-to-last. I'll see if I can find the bug.
An embarrassingly obvious bug: it's trying to do Catmull-Rom interpolation
from three valid data points and one invalid one. The fix:
In section "case CATMULL_ROM_SPLINE:" of Get_Spline_Val(), change the line
else if(i == last)
to
else if(i >= last)
--
Mark
Post a reply to this message
|
|