POV-Ray : Newsgroups : povray.binaries.scene-files : Discontinuous functions? : Re: Discontinuous functions? Server Time
1 Sep 2024 20:20:48 EDT (-0400)
  Re: Discontinuous functions?  
From: JWV
Date: 15 Aug 2004 14:29:11
Message: <411fab77$1@news.povray.org>
hm, I should be reading about #switch statements. Thanks for the tip!

JWV

"Alain" <aze### [at] qwertygov> wrote in message
news:411f95d2@news.povray.org...
> Yadgar nous apporta ses lumieres ainsi en ce 14/08/2004 07:33... :
>
> > High!
> >
> > I'm not really sure whether I'm on-topic here or not... but as this
> > group also deals with programming techniques, I just assumed...
> >
> > My question: does PoV-Ray allow programming of "discontinuous"
> > functions (I only dabble in math, so please don't stone me if this is
> > not the correct terminus!)?
> >
> > Is it possible to write a function which changes apruptly at certain
> > values, such as
> >
> > from x=0 to x=1.5: pow(x, 2)
> > from x=1.5 to x=7: sqrt(14-x)+3
> > etc. etc. ?
> >
> > See you in Khyberspace -
> > http://home.arcor.de/yadgar/khyberspace/index-e.html
> > Afghanistan Chronicle: http://home.arcor.de/yadgar/
> >
> > Yadgar
> >
> > Now playing: Deimos and Phobos go to Mars (Synergy)
>
> It's possible but not alway a good solution. If used in an isosurface,
> it will lead to infinite gradient. It may be preferable to use an union
> of different objects, each modeled acording to a continuous function.
> If used to define a path in an animation, it can lead to whatever is
> folowing that path to jump around.
>
> In your case use a #switch:
> #switch(YourVar)
>     #range(0,1.5)#declare OutVar=pow(YourVar,1);#break
>     #range(1.5,7)#declare OutVar=sqrt(14-YourVar)+3;#break
>     #range(.....
> #end
>
> Alain


Post a reply to this message

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