POV-Ray : Newsgroups : povray.general : Pinching points : Re: Pinching points Server Time
10 Aug 2024 17:29:25 EDT (-0400)
  Re: Pinching points  
From: Peter Popov
Date: 23 Nov 1999 18:45:52
Message: <=CY7OHjEWo2nzG4aPGnfTTON=273@4ax.com>
On Tue, 23 Nov 1999 23:18:44 -0000, "Alf Peake"
<alf### [at] peake42freeservecouk> 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] usanet
ICQ: 15002700


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.