POV-Ray : Newsgroups : povray.advanced-users : Square roots of negative numbers in isosurfaces? Server Time
26 Dec 2024 01:29:02 EST (-0500)
  Square roots of negative numbers in isosurfaces? (Message 1 to 10 of 26)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Greg M  Johnson
Subject: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 09:00:16
Message: <3879E51F.77B9A241@my-dejanews.com>
How "should" an isosurface respond when there is an undefined region of
space?

I just ran something like
        function{noise3d(x^0.5/constant , y/constant , z/constant}
.  The result is symmetric about the x-axis!

Is this an algorithm mistake?

Did pov just uncover a great secret of mathematics: all this fuss over
the square root of negative numbers was a tempest in a teapot??


Post a reply to this message

From: david sharp
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 10:55:10
Message: <387a00de@news.povray.org>
Greg M. Johnson <gre### [at] my-dejanewscom> wrote in message
news:3879E51F.77B9A241@my-dejanews.com...
> How "should" an isosurface respond when there is an undefined region of
> space?
>
> I just ran something like
>         function{noise3d(x^0.5/constant , y/constant , z/constant}
> .  The result is symmetric about the x-axis!
>
> Is this an algorithm mistake?

*I* wouldn't want to get an error every time I had an isosurface
do (-1)^.5,  but I think this is a very debatable topic.
What would you like the program to do in this case?

The isosurface stuff converts x to absolute value of x
before trying to use the ^. This is just to avoid many floating
point errors.  The isosurface code does the same conversion
before applying sqrt() or ln().
Personally I think its OK, (but perhaps the program should put out
a warning). If you look at isosurface scenes posted in these newsgroups,
you will find a lot of square roots and logs of negative numbers being done,
and a lot of this is probably being done completely oblivious to the
mathematical inconsistency.


Post a reply to this message

From: Ron Parker
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 11:02:27
Message: <387a0293@news.povray.org>
On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
>The isosurface stuff converts x to absolute value of x
>before trying to use the ^. This is just to avoid many floating
>point errors.  The isosurface code does the same conversion
>before applying sqrt() or ln().

Does it only do that for fractional exponents, or does it also 
do it for odd integer exponents?

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: david sharp
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 11:45:33
Message: <387a0cad@news.povray.org>
david sharp <dsh### [at] interportnet> wrote in message
news:387a0473@news.povray.org...
>
> Ron Parker <ron### [at] povrayorg> wrote in message
> news:387a0293@news.povray.org...
> > On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
> > >The isosurface stuff converts x to absolute value of x
> > >before trying to use the ^. This is just to avoid many floating
> > >point errors.  The isosurface code does the same conversion
> > >before applying sqrt() or ln().
> >
> > Does it only do that for fractional exponents, or does it also
> > do it for odd integer exponents?
>
> Always.

No, not always. (I should have actually checked before replying)
there is a ffloor test to distinguish integers from fractions.


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 13:53:13
Message: <387A29CF.D6C94973@my-dejanews.com>
Are you sure?

function {noise3d(x ^0.5, y, z)}, I know,  is symmetric about the x=0
plane.
function {noise3d(x^3.0, y, z)}, I will bet, behaves correctly, and has
a kind of symmetry like the curve y=x^3.

There is something "more wrong" here.  If Ron were correct, then x^3
would also be symmetric about x=0.

david sharp wrote:

> david sharp <dsh### [at] interportnet> wrote in message
> news:387a0473@news.povray.org...
> >
> > Ron Parker <ron### [at] povrayorg> wrote in message
> > news:387a0293@news.povray.org...
> > > On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
> > > >The isosurface stuff converts x to absolute value of x
> > > >before trying to use the ^. This is just to avoid many floating
> > > >point errors.  The isosurface code does the same conversion
> > > >before applying sqrt() or ln().
> > >
> > > Does it only do that for fractional exponents, or does it also
> > > do it for odd integer exponents?
> >
> > Always.
>
> No, not always. (I should have actually checked before replying)
> there is a ffloor test to distinguish integers from fractions.


Post a reply to this message

From: david sharp
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 23:17:20
Message: <387aaed0@news.povray.org>
Greg M. Johnson wrote:
> Are you sure?

Sure about what?

> function {noise3d(x ^0.5, y, z)}, I know,  is symmetric about the x=0
> plane.

Because x^.5 actually does (abs( x))^.5
(calling the C function pow(abs(x),.5) )

> function {noise3d(x^3.0, y, z)}, I will bet, behaves correctly, and has
> a kind of symmetry like the curve y=x^3.

Because x^3.0 actually does x*x*x

> There is something "more wrong" here.  If Ron were correct, then x^3
> would also be symmetric about x=0.

Ron didn't claim x^3 was (abs(x))^3. I  prematurely did claim that, and
I was horribly, sorrowfully, and disgustingly mistaken.


> david sharp wrote:
>
> > david sharp <dsh### [at] interportnet> wrote in message
> > news:387a0473@news.povray.org...
> > >
> > > Ron Parker <ron### [at] povrayorg> wrote in message
> > > news:387a0293@news.povray.org...
> > > > On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
> > > > >The isosurface stuff converts x to absolute value of x
> > > > >before trying to use the ^. This is just to avoid many floating
> > > > >point errors.  The isosurface code does the same conversion
> > > > >before applying sqrt() or ln().
> > > >
> > > > Does it only do that for fractional exponents, or does it also
> > > > do it for odd integer exponents?
> > >
> > > Always.
> >
> > No, not always. (I should have actually checked before replying)
> > there is a ffloor test to distinguish integers from fractions.
>
>
>


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 11 Jan 2000 15:26:49
Message: <387B913E.9BBE68F1@my-dejanews.com>
Actually, I think that this is what povray does:

if I say,               noise3d (x^a                            ,  y,z)
it processes        noise3d (sign(x)*pow(abs(x),a),  y,z)

I will try to prove this tonight.
[I thought someone had asked what SHOULD it do--was that note deleted?]  If
povray processes the formula above as I described, there's no problem--it was
just a mystery to be solved . . .


david sharp wrote:

> > function {noise3d(x^3.0, y, z)}, I will bet, behaves correctly, and has
> > a kind of symmetry like the curve y=x^3.
>
> Because x^3.0 actually does x*x*x
>
> > There is something "more wrong" here.  If Ron were correct, then x^3
> > would also be symmetric about x=0.
>
> Ron didn't claim x^3 was (abs(x))^3. I  prematurely did claim that, and
> I was horribly, sorrowfully, and disgustingly mistaken.
>


Post a reply to this message

From: Ron Parker
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 11 Jan 2000 15:38:34
Message: <387b94ca@news.povray.org>
On Tue, 11 Jan 2000 15:23:26 -0500, Greg M. Johnson wrote:
>Actually, I think that this is what povray does:
>
>if I say,               noise3d (x^a                            ,  y,z)
>it processes        noise3d (sign(x)*pow(abs(x),a),  y,z)
>
>I will try to prove this tonight.
>[I thought someone had asked what SHOULD it do--was that note deleted?]  If
>povray processes the formula above as I described, there's no problem--it was
>just a mystery to be solved . . .

Well, there's that little problem of x^2+y^2+z^2-1 (threshold 0) not being a 
sphere anymore, but other than that...


-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 12 Jan 2000 08:15:51
Message: <387C7DB8.95F16859@my-dejanews.com>
Okay, how about:

x^a =  sign(x)^int(a) * pow(abs(x), a)      ?

Povray is doing SOMETHING, as it gives me a picture in a mathematically undefined
region of space!  It was driving me crazy to figure out what it was doing  . . .

Ron Parker wrote:

> Well, there's that little problem of x^2+y^2+z^2-1 (threshold 0) not being a
> sphere anymore, but other than that...
>
> --
> These are my opinions.  I do NOT speak for the POV-Team.
> The superpatch: http://www2.fwi.com/~parkerr/superpatch/
> My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: David Fontaine
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 13 Jan 2000 23:41:23
Message: <387EA67E.7CE91E84@faricy.net>
What I think POV *should* do is not include these areas in the graph. Say I
want to graph a hemisphere on my TI-89, I do x^2+y^2+z^2=1, z^2=-x^2-y^2+1,
z=sqrt(1-x^2-y^2), and graph it and it gives me my hemisphere, and the area
*outside* the hemisphere is ignored (not rendered) because it is sqrt(neg).
Because if people want it to work the other way they can always just make
it sqrt(abs(x)) instead of sqrt(x).

--
Homepage: http://www.faricy.net/~davidf/
___     ______________________________
 | \     |_       <dav### [at] faricynet>
 |_/avid |ontaine      <ICQ 55354965>


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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