|
![](/i/fill.gif) |
On Tue, 23 Nov 1999 23:18:44 -0000, "Alf Peake"
<alf### [at] peake42 freeserve co uk> wrote:
>Given a loop that goes from 0 to 1, in say, 20 equal steps,
>how would I use these figures to give me the same range but
>in non-linear steps that "pinch" or tend to bunch together at
>around 0.75?
>
>I feel a sine function is involved but the best I have managed
>is shown here which I'm not satisfied with. It shows linear Red
>points converted to nonlinear Blue points.
>
>Alf
#declare PinchPoint = 0.75;
#declare StartPoint=0;
#declare EndPoint=1;
#declare Steps=20;
#declare Points=array[Steps];
#declare Points[0]=StartPoint; #declare Points[Steps-1]=EndPoint;
#declare i=1;
#while (i<(Steps-1)/2)
#declare Points[i]=0.5*(Points[i-1]+PinchPoint);
#end
#declare i=Steps-1;
#while (i>=(Steps-1)/2)
#declare Points[i]=0.5*(Points[i+1]+PinchPoint);
#end
#declare Points[(Steps-1)/2]=PinchPoint;
//100% untested, typed it in the newsreader. Sorry, going to sleep :)
Peter Popov
pet### [at] usa net
ICQ: 15002700
Post a reply to this message
|
![](/i/fill.gif) |