POV-Ray : Newsgroups : povray.general : Pinching points : Re: Pinching points Server Time
10 Aug 2024 17:25:00 EDT (-0400)
  Re: Pinching points  
From: Bill DeWitt
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

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