 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
The docs show:
#declare foo2 = function {
spline {
linear_spline
0.0, <0,0,0>
0.5, <1,0,0>
1.0, <0,0,0>
}
}
#declare myvector2 = foo2(0.7);
I am testing code that has:
#declare SPL2_PX = spline{
linear_spline
#for(S_K, 0, S_NSites2D-1)
S_K, A1D_V_P2D[S_K].x,
#end
}
#declare S_PX2 = function {SPL2_PX}
Parse Error: Expected 'operand', spline identifier found instead
Unless I'm doing something wrong. Which is rather often the case.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> The docs show:
>
> #declare foo2 = function {
> spline {
> linear_spline
> 0.0, <0,0,0>
> 0.5, <1,0,0>
> 1.0, <0,0,0>
> }
> }
>
> #declare myvector2 = foo2(0.7);
>
>
> I am testing code that has:
>
> #declare SPL2_PX = spline{
> linear_spline
> #for(S_K, 0, S_NSites2D-1)
> S_K, A1D_V_P2D[S_K].x,
> #end
> }
>
> #declare S_PX2 = function {SPL2_PX}
>
> Parse Error: Expected 'operand', spline identifier found instead
>
> Unless I'm doing something wrong. Which is rather often the case.
>
> - BE
I found it! The function can not use a predefined spline so if you want a
function to use a spline define the spline in the function
#declare S_PX2 = function {
spline{
linear_spline
#for(S_K, 0, S_NSites2D-1)
S_K, A1D_V_P2D[S_K].x,
#end
}}
Works for me!
Have Fun!
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Leroy" <whe### [at] gmail com> wrote:
> #declare S_PX2 = function {
> spline{
> linear_spline
> #for(S_K, 0, S_NSites2D-1)
> S_K, A1D_V_P2D[S_K].x,
> #end
> }}
Yes and that is indeed what I did.
However it seems to be bad behaviour by the parser, and locks the spline into a
single-use object.
IIRC, I can use pre-declared splines in sphere_sweep without a problem.
The inability falls under the "contrary to user expectation", and that's why
it's in this section.
Thank you, of course, for providing the workaround.
I wonder how many other things we have like this lurking around in the source.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
hi,
"Bald Eagle" <cre### [at] netscape net> wrote:
> "Leroy" <whe### [at] gmail com> wrote:
>
> > #declare S_PX2 = function {
> > spline{
> > linear_spline
> > #for(S_K, 0, S_NSites2D-1)
> > S_K, A1D_V_P2D[S_K].x,
> > #end
> > }}
>
> Yes and that is indeed what I did.
>
> However it seems to be bad behaviour by the parser, and locks the spline into a
> single-use object.
>
> IIRC, I can use pre-declared splines in sphere_sweep without a problem.
>
> The inability falls under the "contrary to user expectation", and that's why
> it's in this section.
>
> Thank you, of course, for providing the workaround.
> I wonder how many other things we have like this lurking around in the source.
it actually does work, though you have to tell the function:
#declare S_PX2 = function {spline{SPL2_PX}};
regards, jr.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"jr" <cre### [at] gmail com> wrote:
> it actually does work, though you have to tell the function:
>
> #declare S_PX2 = function {spline{SPL2_PX}};
I quickly tried one or two constructs pointed in this direction, but clearly
didn't land on that one.
Good to know for future code edits.
As always,
Thanks! :)
- bw
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 04.11.2025 12:17, Bald Eagle wrote:
> "Leroy" <whe### [at] gmail com> wrote:
>
>> #declare S_PX2 = function {
>> spline{
>> linear_spline
>> #for(S_K, 0, S_NSites2D-1)
>> S_K, A1D_V_P2D[S_K].x,
>> #end
>> }}
>
> Yes and that is indeed what I did.
>
> However it seems to be bad behaviour by the parser, and locks the spline into a
> single-use object.
>
> IIRC, I can use pre-declared splines in sphere_sweep without a problem.
>
> The inability falls under the "contrary to user expectation", and that's why
> it's in this section.
Not behaves exactly as designed: The function parser cannot handle
declared objects because you are falling into the POV-Ray declares are
not macros trap. The parser first needs to know that you want a spline
function, then it can make use of the spline object.
Thorsten
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 04.11.2025 12:55, jr wrote:
> it actually does work, though you have to tell the function:
>
> #declare S_PX2 = function {spline{SPL2_PX}};
Exactly! And that is the logical way to do this, too. First tell the
parser that you actually want a spline function, then you can use a
spline. The regular syntax declares a plain function, not a spline function.
Thorsten
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
hi,
Thorsten <tho### [at] trf de> wrote:
> On 04.11.2025 12:55, jr wrote:
> > it actually does work, though you have to tell the function:
> >
> > #declare S_PX2 = function {spline{SPL2_PX}};
>
> Exactly! And that is the logical way to do this, too. First tell the
> parser that you actually want a spline function, then you can use a
> spline. The regular syntax declares a plain function, not a spline function.
agree with the "consistent" point in the other post, the situation is exactly
like, say, with a 'pigment {}'.
regards, jr.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |