|
|
Am 07.08.2016 um 02:17 schrieb Bald Eagle:
> Thanks - I do understand and appreciate that there are a lot of things that are
> intertwined and virtually inextricably embedded in POV-Ray, and would take a
> major rewrite to fix, or add.
> I'll keep plugging away at it. :)
>
> Can you explain what the following excerpt from the docs _means_ ?
>
> "Also, function splines take the vector size into account. That is, a function
> containing a spline with five components will also return a five component
> vector (aka a color), a function containing a spline with two components will
> only return a two component vector and so on. "
Ah -- that explains why I was surprised that splines didn't work in
functions.
Having read the relevant portions of the docs again, it turns out you
can do the following:
// Declare a normal spline.
#declare MySpline = spline {
...
}
// Declare a spline function.
// (Note that this returns a vector, not a float.)
#declare MySplineFn = function { spline { MySpline } }
// Use the spline function in a regular function.
// (Note the `.x` to access the spline function result's
// first coordinate; don't confuse it with the `x` denoting
// the function's first parameter.)
#declare MyFn = function(x) { ... MySplineFn(x).x ... }
(You can also place the actual definition of the spline into the spline
function itself.)
Post a reply to this message
|
|