|
![](/i/fill.gif) |
On 22 Feb 2002 05:21:21 -0500, Warp <war### [at] tag povray org> wrote:
>W?odzimierz ABX Skiba <abx### [at] babilon org> wrote:
> > Your ideas could be simple realized via macros.
>
> How?
#version 3.5;
#include "strings.inc"
#macro Make_List()
#local N=dimension_size(Array,1);
#local C=N;
#while(C)
#local C=C-1;
From+C*(To-From)/(N-1) Array[C]
#end
#end
#macro Distribution(From,To,Array)
spline{Make_List()}
#end
#macro Add_Distribution(Spline,From,To,Array)
#declare Spline=spline{Spline Make_List()}
#end
// create spline with first distribution
#local Spline=Distribution(0,1,array[3]{<0,0,0><1,0,0><2,1,0>})
// add distribution to spline
// note you can mix ranges, overwrite and mix
Add_Distribution(Spline,1,2,array[3]{<2,1,0><3,2,1><2,2,2>})
// testing
#debug VStr((Spline(0)))
#debug "\n"
#debug VStr((Spline(.5)))
#debug "\n"
#debug VStr((Spline(1)))
#debug "\n"
#debug VStr((Spline(1.5)))
#debug "\n"
#debug VStr((Spline(2)))
#debug "\n"
// ABX
Post a reply to this message
|
![](/i/fill.gif) |