POV-Ray : Newsgroups : povray.general : Pinching points : Re: Pinching points Server Time
10 Aug 2024 17:27:10 EDT (-0400)
  Re: Pinching points  
From: Chris Colefax
Date: 24 Nov 1999 07:46:42
Message: <383bde32@news.povray.org>
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.

You could use a sine curve, but this doesn't give you much control over
the amount of pinching.  Perhaps breaking the linear sequence into two
sections (before and after 0.75) and applying powers to them could work
(normalising each section first, inverting the first and raising both to
the same power, and then retransforming each section back to fit):

union {
   #declare C = 0; #while (C <= 1)
      sphere {x*(C < .75
         ? (1 - pow(1 - (C/.75), 2))*.75
         : pow((C-.75)/.25, 2)*.25 + .75
         ), .02}
   #declare C = C + 1/20; #end
   pigment {rgb <0, 0, 1>}}


Post a reply to this message

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