POV-Ray : Newsgroups : povray.general : Pinching points Server Time
10 Aug 2024 23:25:05 EDT (-0400)
  Pinching points (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Bill DeWitt
Subject: Re: Pinching points
Date: 24 Nov 1999 09:40:01
Message: <383bf8c1@news.povray.org>
Alf Peake <alf### [at] peake42freeservecouk> wrote in message
news:383b2166@news.povray.org...
> 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 use a simple sine function to offset the peak a little, perhaps it will
help you.

////////////// Camera //////////////////////
camera {                                  //
        right      < -1.333, 0.0, 0.0 >   //
        up         <  0.0, 1.0, 0.0 >     //
        direction  <  0.0, 0.0, 1.0 >     //
        location   <  0.0, 0.0, 4.0 >     //
        look_at    <  0.0, 0.0, 0.0 >     //
       }                                  //
////////////// end Camera //////////////////

///////////////  Light  ////////////////
light_source { < 100.0, 100.0, 100.0 >
color rgb < 1.0, 1.0, 1.0 > }
///////////////////////////////////////

#declare I = 0;
  #while ( I < 1)
   sphere {0, 0.05 pigment { rgb 1 } translate < I, sin((I*I*I)*pi), 0 > }
  #declare I = I + 0.001;
#end


Post a reply to this message

From: Alf Peake
Subject: Re: Pinching points
Date: 25 Nov 1999 15:08:59
Message: <383d975b@news.povray.org>
I've uploaded to my freeserve site an 800*600 52k jpeg to show why I was
yelling for help. I wanted a spider's web to go with my 2 year old spider on
Compuserve homepage. One part completed fly to go. Been nibbling at the web
problem for months.

Your solution looks just dandy Chris, many thanks and looks like I can sleep
now :o)

Thanks Bill for your suggestion. Curve is the right shape but x-spacing is
linear. I can work from that tho' if I need to..

And Peter - still working on yours before I had to get upstairs too. Added
the loop decrements as well <i=i-1> incase anyone is puzzled.

Alf

One spider's web (under construction ;-)
http://www.peake42.freeserve.co.uk/pix1/web.jpg

and 1 completed hairy spider:
http://ourworld.compuserve.com/homepages/Alf_Peake/


Chris Colefax <cco### [at] geocitiescom> wrote in message
news: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

From: Peter Popov
Subject: Re: Pinching points
Date: 25 Nov 1999 15:50:32
Message: <aaA9OMBURG0x8NUiAVMeIA5oRTgI@4ax.com>
On Thu, 25 Nov 1999 14:33:02 -0000, "Alf Peake"
<alf### [at] peake42freeservecouk> wrote:

>And Peter - still working on yours before I had to get upstairs too. Added
>the loop decrements as well <i=i-1> incase anyone is puzzled.
>
>Alf

You mean you have to decrement those loop control variables? Adding
them does seem to make parsing a helluva lot easier indeed :)


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Bill DeWitt
Subject: Re: Pinching points
Date: 25 Nov 1999 15:57:21
Message: <383da2b1@news.povray.org>
Alf Peake <alf### [at] peake42freeservecouk> wrote :
>
> Thanks Bill for your suggestion.
>

    You're welcome, but you made me curious and now I am working on making
an easy way to peak at whatever place you want to while making the whole
curve smooth. I haven't studied Chris's and Peter's yet because I want to
see what I can come up with by myself...


Post a reply to this message

From: Peter Popov
Subject: Re: Pinching points
Date: 26 Nov 1999 02:55:32
Message: <2Dw+OHypO14SZdJeQei=KLNK6g7o@4ax.com>
On Thu, 25 Nov 1999 15:57:20 -0500, "Bill DeWitt"
<the### [at] earthlinknet> wrote:

>    You're welcome, but you made me curious and now I am working on making
>an easy way to peak at whatever place you want to while making the whole
>curve smooth. I haven't studied Chris's and Peter's yet because I want to
>see what I can come up with by myself...

Beware of infinitely long parsing times with mine :)


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Chris Colefax
Subject: Re: Pinching points
Date: 26 Nov 1999 20:41:56
Message: <383f36e4@news.povray.org>
Bill DeWitt <the### [at] earthlinknet> wrote:
>     You're welcome, but you made me curious and now I am working on
making
> an easy way to peak at whatever place you want to while making the
whole
> curve smooth. I haven't studied Chris's and Peter's yet because I want
to
> see what I can come up with by myself...

I think this may be somewhat difficult with a spline curve: to pinch a
linear sequence (in one dimension) you need an ever-increasing curve
that slows down as it approaches the pinch point and speeds up
afterwards.  A spline curve, though, is only increasing from -pi/2 to
pi/2 (plus or minus whole multiples of 2*pi), and in this period the
curve accelerates from the start and decelerates towards the end.  This
pinches the spacing towards the beginning and end, and stretches it in
the middle - the opposite of what we're looking for!

Parametising the code I posted shouldn't be too hard, eg:

#declare PinchPoint = 0.75;
#declare PinchPower = 2; // 1 = no pinching, increase for more

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


Post a reply to this message

From: Bill DeWitt
Subject: Re: Pinching points
Date: 27 Nov 1999 01:17:48
Message: <383f778c@news.povray.org>
Chris Colefax <cco### [at] geocitiescom> wrote :
>
> Parametising the code I posted shouldn't be too hard, eg:
>

Well, I came up with almost (but not quite I don't think) exactly what Chris
came up with.

Not that that is bad, I just wish I had come up with something new and
unusual... to see it, run this in an animation with about 20 frames or more.
Or see Graph.avi in p.b.a.

/// Begin pov code
////////////// Camera ////////////////////////
camera

        right      < -4/3, 0.0, 0.0 >
        up         <  0.0, 1.0, 0.0 >
        direction  <  0.0, 0.0, 1.0 >
        location   <  0.0, 0.0, 3.0 >
        look_at    <  0.0, 0.0, 0.0 >
       }

///////////////  Light  //////////////////
light_source { < 100.0, 200.0, 200.0 >
color rgb < 1.0, 1.0, 1.0 > }

////////////////////////////////////////////////////////////////////////////
//////////
/// #include "C:\My Documents\PovFiles\tools\TestPad.inc"
TestPad( <-1.0, -1.0, 0.0 >)

#macro Peak( Location, Height, Index, Power )

        /// While Index is less than Location, rises from 0 to 1
        /// While Index is greater than Location descends to 0
        /// Location is where you want the peak to be,
        /// Height is how far up the pinch goes,
        /// Index is whatever you use to increment the value,
        /// Power is the slope, 1 is linear, 2 is curved and higher is
sharper

        // fix divide by zero
        #if  ( Location = 0.0 )
        #local Location = 0.0001;
        #end

       /// This is the calculation of the value
        (
         ( Index <= Location ) ?
         pow( (  Index /   Location ), Power )*Height :
         pow( (1-Index)/(1-Location ), Power )*Height
        )

        #end
/// A bunch of arbitrary values
#declare Location = clock;
#declare Height   = (sin(clock*pi)/2)+0.25;
#declare Power    = 3.0;
/// Loop to draw a line
#declare Index    = 0.0;
#while (Index < 1 )

      sphere {0, 0.04    pigment { rgb < Peak ( Location, Height, Index,
Power ),
                                         0.0,
                                         1.0-Peak ( Location, Height, Index,
Power ) >
                                 }
                         finish  { ambient 1 }
                         translate < Index, Peak ( Location, Height, Index,
Power ), 0 > }

#declare Index = Index + 0.005;
#end


Post a reply to this message

From: Alf Peake
Subject: Re: Pinching points
Date: 27 Nov 1999 06:29:17
Message: <383fc08d@news.povray.org>
I still like Chris's solution best. Peter's are a bit too pinched but I'm
sure a root would solve that.

My problem is that I tend to try and copy something real and it always turns
out harder than expected. If you think of cobwebs as being made of thin
rubber then any prospective meal will only cause local distortion (like
negative warp?). I put the fly _on_ a (random) spoke because I thought that
would be easier to work on than _between_ spokes. Most everything is random
and the 0 to 1 loop I sought help on is the scaling factor of the spiral
section of around 20 turns. Each time it  _finds_ the active spoke it
modifies the scaler for that spoke.

Any-one who suggests a morning dew would look good gets terminated!  :-)


Alf

http://www.peake42.freeserve.co.uk
http://ourworld.compuserve.com/homepages/Alf_Peake/


Bill DeWitt <the### [at] earthlinknet> wrote in message
news:383da2b1@news.povray.org...
>
> Alf Peake <alf### [at] peake42freeservecouk> wrote :
> >
> > Thanks Bill for your suggestion.
> >
>
>     You're welcome, but you made me curious and now I am working on making
> an easy way to peak at whatever place you want to while making the whole
> curve smooth. I haven't studied Chris's and Peter's yet because I want to
> see what I can come up with by myself...
>
>


Post a reply to this message

From: Ken
Subject: Re: Pinching points
Date: 27 Nov 1999 11:29:23
Message: <3840067A.7173B69C@pacbell.net>
Alf Peake wrote:

> Any-one who suggests a morning dew would look good gets terminated!  :-)

Have you thought about putting a little early morning moisture on the web.
That would look cool !

:)

-- 
Ken Tyler -  1200+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Alf Peake
Subject: Re: Pinching points
Date: 28 Nov 1999 06:50:03
Message: <384116eb@news.povray.org>
Ken,

I've fixed you up with a dinner date with my very good friend Arachnia.
Anything else I can do for you in the short time available?
;-)

Alf


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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