|
|
As we can't use arrays inside functions I tried something else. A spline
is an array, kind of and works in functions. So some test code, that
works. There's one little thing I don't realy understand. I have to undef
the 'i' used in SPL or rename it or the one in N. Otherwise I get:
line xxx: Parse Error: Local variable name expected!
---%<------%<------%<---
#declare arrSPL = array[5]{
<0,0>,
<1,0>,
<2,0>,
<3,0>,
<4,0>
}
#declare SPL = spline{
#for(i,0,dimension_size(arrSPL,1)-1)
i, arrSPL[i],
#end
}
#debug concat(str(SPL(4).x,5,5),"\n")
#undef arrSPL
#undef i // <--------- !!
#declare Ar = function{
spline{SPL}
}
#debug concat(str(Ar(4).x,5,5),"\n")
#undef SPL
#declare N = function(D){sum(i, 0, D, Ar(i).x)};
#declare NAR = N(4);
#debug concat(str(NAR,5,5),"\n")
---%<------%<------%<---
Ingo
Post a reply to this message
|
|