POV-Ray : Newsgroups : povray.newusers : isosurfaces? Server Time
30 Jul 2024 22:18:12 EDT (-0400)
  isosurfaces? (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Tom Melly
Subject: Re: isosurfaces?
Date: 4 Nov 2003 07:58:15
Message: <3fa7a267$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message news:3fa7a09a@news.povray.org...
> Christoph Hormann <chr### [at] gmxde> wrote:
> > Actually you should use sqrt() instead of pow(,0.5).
>
>   How about simply squaring the radius (R*R) instead of using the slow
> sqrt() function?-)

He's got a point.... in which case it would make sense to declare R as the
square of whatever value you want to use?

So, Chris's example becomes:

#declare R=2*2;
#declare FSphere=function {(x*x+y*y+z*z) - R}


Post a reply to this message

From: Warp
Subject: Re: isosurfaces?
Date: 4 Nov 2003 08:30:17
Message: <3fa7a9e9@news.povray.org>
Tom Melly <tom### [at] tomandlucouk> wrote:
> #declare R=2*2;
> #declare FSphere=function {(x*x+y*y+z*z) - R}

  Having the radius as parameter has certain advantages, though.
For instance, the radius does not have to be constant thorough the
entire surface of the sphere... :)

  Example:

#declare FSphere = function(x,y,z,R) { (x*x+y*y+z*z) - R*R }

isosurface
{ function { FSphere(x,y,z, 2-.5*f_noise3d(x*5,y*5,z*5)) }
  ...
}

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Christoph Hormann
Subject: Re: isosurfaces?
Date: 4 Nov 2003 12:32:03
Message: <p94l71-s2l.ln1@triton.imagico.de>
Warp wrote:
> 
>   How about simply squaring the radius (R*R) instead of using the slow
> sqrt() function?-)

Because that function would have a non-constant gradient.  With the (way 
too large) container box{-5,5} you need quite a high max_gradient to 
correctly render it -> it will be slower than with sqrt().

Of course using the internal function f_sphere() would be even faster.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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