POV-Ray : Newsgroups : povray.general : Possible bug: negative sphere radius Server Time
5 Aug 2024 14:17:06 EDT (-0400)
  Possible bug: negative sphere radius (Message 1 to 9 of 9)  
From: Andrew Coppin
Subject: Possible bug: negative sphere radius
Date: 21 Sep 2002 15:12:41
Message: <3d8cc4a9@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apologies if I totally fluff this up - never used a news server
before!

Take a look at this POVRay scene file:

sphere {<5, 5, 5>, -7}

Shouldn't that generate an error message? (It doesn't on POVRay 3.5
for Windows.)

Andrew.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPYzEpLEpzUF0Y1JeEQIQigCgjoWOlSxvYo7Gf5utR5GnHRux4roAoNQt
BpAUsCMxn+lZdow6DBa0LvIr
=i3tW
-----END PGP SIGNATURE-----


Post a reply to this message

From: Slime
Subject: Re: Possible bug: negative sphere radius
Date: 21 Sep 2002 15:45:46
Message: <3d8ccc6a$1@news.povray.org>
If it creates a sphere of radius 7, then it's doing what it's supposed to.

It's plugging in the -7 into the equation for a sphere and solving for
interesections. No mathematical problems occur because of this.

There are a lot of places where you can enter numbers that don't make sense
(like negative colors for light sources or transparency greater than 1) that
allow you to create interesting effects.

I think as long as it doesn't cause any calculation issues (like
vnormalize(0,0,0) did), there's no reason to restrict it.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: Possible bug: negative sphere radius
Date: 21 Sep 2002 16:36:12
Message: <QPw$+BAJcNj9EwHH@econym.demon.co.uk>
Wasn't it Slime who wrote:

>Andrew Coppin wrote:
>>
>>Hash: SHA1
>>
>>Apologies if I totally fluff this up - never used a news server
>>before!
>>
>>Take a look at this POVRay scene file:
>>
>>sphere {<5, 5, 5>, -7}
>>
>>Shouldn't that generate an error message? (It doesn't on POVRay 3.5
>>for Windows.)
>
>If it creates a sphere of radius 7, then it's doing what it's supposed to.
>
>It's plugging in the -7 into the equation for a sphere and solving for
>interesections. No mathematical problems occur because of this.
>
>There are a lot of places where you can enter numbers that don't make sense
>(like negative colors for light sources or transparency greater than 1) that
>allow you to create interesting effects.
>
>I think as long as it doesn't cause any calculation issues (like
>vnormalize(0,0,0) did), there's no reason to restrict it.

But "sphere {<5,5,5>,-7}" does have some really weird properties. 
It's "inside" is on the inside (for CSG purposes), but it's
"interior_texture" is on the outside. Usually objects have their
interior_texture and CSG inside on the same side.

It also disappears when bounding is active. The bounding box looks like
it's in the right place when viewed with +UD, but the bounding box is
actually inside out (min_extent is <12,12,12> and max_extent is
<-2,-2,-2>) and the bounding box statistics always show zero successes.

In this particular case, if Andrew doesn't like these effects, then he
has only himself to blame for choosing to use a negative radius, but if
someone wrote "sphere {<5,5,5>, Complicated_Expression}" they may not
immediately realize that the weird effects are due to the complicated
expression evaluating to a negative result, and would probably
appreciate a warning message.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Slime
Subject: Re: Possible bug: negative sphere radius
Date: 21 Sep 2002 16:59:44
Message: <3d8cddc0@news.povray.org>
> But "sphere {<5,5,5>,-7}" does have some really weird properties.


Yeah, these are weird. In this case, then, it probably *does* make sense to
either (a) make it behave as expected or (b) produce an error message.

And probably b, since the "expected" behavior is probably hard to agree on.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Warp
Subject: Re: Possible bug: negative sphere radius
Date: 21 Sep 2002 20:23:06
Message: <3d8d0d6a@news.povray.org>
Slime <slm### [at] slimelandcom> wrote:
> And probably b, since the "expected" behavior is probably hard to agree on.

  I agree. There are good reasons for wanting a negative radius to act
as the equivalent positive radius, as well as there are good reasons for
a sphere with negative radius to not to appear at all. Also one possible
interpretation would be that it would be the equivalent sphere with
positive radius, but inverted.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Mike Williams
Subject: Re: Possible bug: negative sphere radius
Date: 22 Sep 2002 01:48:48
Message: <pHtxsCA8lVj9Ewg0@econym.demon.co.uk>
Wasn't it Slime who wrote:
>> But "sphere {<5,5,5>,-7}" does have some really weird properties.
>
>
>Yeah, these are weird. In this case, then, it probably *does* make sense to
>either (a) make it behave as expected or (b) produce an error message.
>
>And probably b, since the "expected" behavior is probably hard to agree on.

I think an error is preferable, but one reasonable expected behaviour
would be to have it behave in the same way as a cylinder. A cylinder of
negative radius is indistinguishable from a cylinder of positive radius
in all respects that I've tested. This could easily be achieved by
taking the abs() of the radius as the sphere is parsed. 


We should also consider the sphere_sweep with negative radius which
exhibits most of the same weirdness as the sphere, and possibly the
torus with negative major radius which is weird in a different way.
The other primitive shapes seem to behave sensibly.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Possible bug: negative sphere radius
Date: 22 Sep 2002 04:21:07
Message: <3d8d7d73@news.povray.org>
In article <pHt### [at] econymdemoncouk> , Mike Williams 
<mik### [at] econymdemoncouk>  wrote:

> This could easily be achieved by
> taking the abs() of the radius as the sphere is parsed.

I agree that something like this should indeed work.  Probably taking the
absolute value and if the radius was negative there is an implied "inverse".

That would fix the current inconsistency and create what is probably
intended by specifying a negative radius.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Andrew Coppin
Subject: Zero-radius spheres (and 4D geometry!)
Date: 22 Sep 2002 06:44:21
Message: <3d8d9f05@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's an interesting one then... how about a zero-radius sphere? If
you ask for a plane with normal <0, 0, 0> you get an error...
Shouldn't a zero-radius sphere do the same? (It doesn't.)

Actually... (Oh God here we go!) A zero-radius sphere is kinda useful
in a way; it produces an object such that all of space is 'outside'.
If you add the inverse keyword, you now have an object such that all
of space in 'inside'. I'm currently working on a 4D visualisation
system written with POV-Ray, and these 'all-inside' and 'all-outside'
objects are usefull for CSG intersection operations. (In particular,
an object ax + by + cd + dw - k = 0 only has a surface in the 3-space
defined by w = m if <a, b, c> != <0, 0, 0>. Otherwise, if dm - k > 0,
all of 3-space is 'outside', or if dm - k < 0 then all of 3-space is
'inside'. If you want to build a hypercube out of the CSG
intersection of 8 hyperplanes, having a macro which can return
'all-inside' or 'all-outside' objects is rather useful ;-)

OK, if you don't follow that last part... don't worry!

Andrew.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPY2de7EpzUF0Y1JeEQK5zQCfWG43G7ONii6Dd7zDDrIjZGtgdtoAoLax
dr5YS0L9CiaDqdNMSLpImhF9
=Ph9A
-----END PGP SIGNATURE-----


Post a reply to this message

From: Christoph Hormann
Subject: Re: Zero-radius spheres (and 4D geometry!)
Date: 22 Sep 2002 07:18:12
Message: <3D8DA6F4.F1DC6EE6@gmx.de>
Andrew Coppin wrote:
> 
> Here's an interesting one then... how about a zero-radius sphere? If
> you ask for a plane with normal <0, 0, 0> you get an error...
> Shouldn't a zero-radius sphere do the same? (It doesn't.)

Actually there is a big difference between a sphere with radius 0 and a
plane with a zero normal vector.  While the former is perfectly correct
(although quite useless in most situations) the latter is mathematically
undefined (like a cylinder with identical base and end point) and
therefore produces an error.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

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