POV-Ray : Newsgroups : povray.general : gravity well : Re: gravity well Server Time
4 May 2024 20:14:44 EDT (-0400)
  Re: gravity well  
From: Grassblade
Date: 11 Oct 2007 18:15:00
Message: <web.470e9f9050ab97d7ad7ea8820@news.povray.org>
"alphaQuad" <alp### [at] earthlinknet> wrote:
> "Grassblade" <nomail@nomail> wrote:
>
> > Because he forgot parentheses. That expression simplifies to x*x-0.002+z*z,
> > which is a circle for every y, so a cylinder. Try x*x-0.002/(y*y)+z*z
>
> GREAT!!!!!!!!!!!!! renders 2 reversed wells
>
> but it wont let me intersection or difference out one half
> and keeps whining about the function line:
>
> starts rendering then half way thru error is:
>
> Parse Error: Floating-point exception detected in function ''. Your function
> either attempted a division by zero, used a function outside its domain or
> called an internal function with invalid parameters.
> difference {
>
>  isosurface {
>     function { (x*x) - (0.005/(y*y)) + (z*z) }
>    threshold 0
>  max_gradient 9
>  contained_by {box {<-1,-1,-1>, < 1, 1, 1>}}
>  open
>     texture {
>     pigment{ CadetBlue }
>     finish { ambient .4 }
>     }
>     scale 6
>     translate <0,0, 0>
> }
> box {<-1,-1,-1>, < 1, 1, 1>
>       scale 2
>       translate < 0, -2, 0>
>    }
> }
>
>
>
> what should one do here?
You don't want to use CSG with isosurfaces, check the tutorial at
http://www.povray.org/documentation/view/3.6.1/73/ it explains how to make
operations similar to CSG operations within the isosurface definition.

Regarding division by zero, contained_by acts like the domain of your
function. Since the domain comprises y=0, you should make sure your
denominator never reaches 0.
You can either add a small value to it (e.g. 0.002/(y*y+0.00001)), or modify
the contained_by line such that it doesn't include 0 for y, like
contained_by {box {<-1,0.0001,-1>, < 1, 1, 1>}}
This second solution should have the added advantage of getting rid of the
other well.


Post a reply to this message

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