|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
I'm trying to create a function that gets some values by a spline. But when I'm
trying to render the scene, the following error occurs:
"Expected 'operand', spline identifier found instead"
The simplest scene in which I found this error is something like that:
// First of all declare a spline - a circle made of 8 points with cubic spline
// I don't have any problems with this spline in other scenes
#declare SPL =
spline {
cubic_spline
#declare SPLI=-1/8;
#while (SPLI<=1+1/8)
SPLI, <sin(2*pi*SPLI),0,cos(2*pi*SPLI)>
#declare SPLI=SPLI+1/8;
#end
}
// now declare a function that calculates the average (arithmetic mean) of the
// x-values of the spline. "Exactness" says how many points I want to use.
#declare xAverage=function(Exactness) {
sum(i,0,Exactness,
SPL(i/Exactness).x // here the error occurs
)
/(Exactness+1)
}
// end of file
Where is my mistake? Could you please help me? Is the sum the reason?
I'm using POV-Ray 3.7 (the beta version).
Thanks,
Sven
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SvenM wrote:
> Hi,
>
> I'm trying to create a function that gets some values by a spline. But when I'm
> trying to render the scene, the following error occurs:
>
> "Expected 'operand', spline identifier found instead"
>
> The simplest scene in which I found this error is something like that:
>
> // First of all declare a spline - a circle made of 8 points with cubic spline
> // I don't have any problems with this spline in other scenes
> #declare SPL =
> spline {
> cubic_spline
>
>
> #declare SPLI=-1/8;
> #while (SPLI<=1+1/8)
> SPLI, <sin(2*pi*SPLI),0,cos(2*pi*SPLI)>
> #declare SPLI=SPLI+1/8;
> #end
> }
>
>
> // now declare a function that calculates the average (arithmetic mean) of the
> // x-values of the spline. "Exactness" says how many points I want to use.
>
> #declare xAverage=function(Exactness) {
> sum(i,0,Exactness,
> SPL(i/Exactness).x // here the error occurs
> )
> /(Exactness+1)
> }
>
>
> // end of file
>
> Where is my mistake? Could you please help me? Is the sum the reason?
> I'm using POV-Ray 3.7 (the beta version).
Hi,
Functions are restricted to what they can have inside of them, as
they are able to be evaluated at render time. However, I believe
there's an easy fix for you. Try creating a function from your spline
and call that instead:
#declare SPL_F =
function {
spline { SPL }
}
or
#declare SPL_F =
function {
spline {
cubic_spline
#declare SPLI=-1/8;
#while (SPLI<=1+1/8)
SPLI, <sin(2*pi*SPLI),0,cos(2*pi*SPLI)>
#declare SPLI=SPLI+1/8;
#end
}
}
--
-The Mildly Infamous Blue Herring
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hi,
> Functions are restricted to what they can have inside of them, as
> they are able to be evaluated at render time. However, I believe
> there's an easy fix for you. Try creating a function from your spline
> and call that instead:
>
> #declare SPL_F =
> function {
> spline { SPL }
> }
>
> or
>
> #declare SPL_F =
> function {
> spline {
> cubic_spline
>
> #declare SPLI=-1/8;
> #while (SPLI<=1+1/8)
> SPLI, <sin(2*pi*SPLI),0,cos(2*pi*SPLI)>
> #declare SPLI=SPLI+1/8;
> #end
> }
> }
>
Thank you very much! It seems to work. IMHO it's a little bit confusing that
function{} doesn't allow to call a spline, but it CAN be a spline itself...
Yours, Sven
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|