POV-Ray : Newsgroups : povray.newusers : Isosurfaces and 1/x Server Time
24 Nov 2024 21:11:43 EST (-0500)
  Isosurfaces and 1/x (Message 1 to 3 of 3)  
From: Simon Wall
Subject: Isosurfaces and 1/x
Date: 3 Jul 2007 09:40:02
Message: <web.468a519a7e2b1fec655d21d50@news.povray.org>
Hi,

I'm new to POV ray and I am trying to plot a mathematical function with an
isosurface. The problem is, I have a term which is z*z/(x*x + y*y + z*z)
which should be 1 for z=y=z=0, however pov doesn't like it and thinks it is
dividing by 0.

Anyone know how to get round this?


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurfaces and 1/x
Date: 3 Jul 2007 10:30:32
Message: <wy4PTDAVxliGFwGk@econym.demon.co.uk>
Wasn't it Simon Wall who wrote:
>Hi,
>
>I'm new to POV ray and I am trying to plot a mathematical function with an
>isosurface. The problem is, I have a term which is z*z/(x*x + y*y + z*z)
>which should be 1 for z=y=z=0, however pov doesn't like it and thinks it is
>dividing by 0.
>
>Anyone know how to get round this?

If you use 
        (z*z+0.0000000001)/(x*x + y*y + z*z +0.0000000001)
then the value at <0,0,0> will be 1, and the values everywhere else will
be indistinguishable from the real values. (For example, the value at
<1,2,3> differs from the true value by 0.00000000000255).

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Alain
Subject: Re: Isosurfaces and 1/x
Date: 3 Jul 2007 11:04:29
Message: <468a657d@news.povray.org>
Simon Wall nous apporta ses lumieres en ce 2007/07/03 09:39:
> Hi,
> 
> I'm new to POV ray and I am trying to plot a mathematical function with an
> isosurface. The problem is, I have a term which is z*z/(x*x + y*y + z*z)
> which should be 1 for z=y=z=0, however pov doesn't like it and thinks it is
> dividing by 0.
> 
> Anyone know how to get round this?
> 
> 
It don't think it's dividing by zero, it is.
with x=y=z=0 you have: 0*0/(0*0+0*0+*0*)= 0/0 whitch is undefined.
Just add a very small value to both terms:(z*z+1e-9)/(x*x+y*y+z*z+1e-9)

-- 
Alain
-------------------------------------------------


Post a reply to this message

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