POV-Ray : Newsgroups : povray.advanced-users : Bug, Proceedure, or simply Unpredictable ? : Re: Bug, Proceedure, or simply Unpredictable ? Server Time
30 Jul 2024 14:22:10 EDT (-0400)
  Re: Bug, Proceedure, or simply Unpredictable ?  
From: Ron Parker
Date: 17 May 1999 10:53:23
Message: <37401f53.0@news.povray.org>
On Mon, 17 May 1999 00:27:15 -0700, Ken wrote:
>Is it A, B, C, or D or ?
>
>A. A Bug
>B. A predictable by product of coincident surfaces
>C. An unpredictable problem that one could easil expect
>   under these operating conditions
>D. combinations of the previous three options

I'd call it B, with a smattering of C.  

>> We all know that you shouldn't let the two objects in difference{} have a
>> plane in common, because the algorithm can't decide which of the two is "on
>> top" as it were.
>> 
>> But what about intersections?  Even if the algorithm can't decide between the
>> two planes, it ought to find one or the other to be "inside", and respond to
>> that one.

Why should it?  If a point is on the surface of an object, is it inside or
outside?  Also, keep in mind that there is no difference between difference
and intersection.  The internal implementation of 

difference {object {A} object {B}} 

is

intersection {object {A} object {B inverse}}

Here's what the CSG-intersection algorithm does:  First, it finds all 
intersections[1] of your ray with the object in question.  Next, it tests 
the intersections in the order in which they were encountered, looking for 
one that is inside every sub-object in the CSG except the one that was hit.
If this doesn't hold for the first intersection, it goes to the next, and 
so on.

So let us look at the case in question.  The ray hits both planes at the same
point.  The sorting algorithm sorts one intersection in front of the other, 
in a predictable but seemingly random way.  Note that if cylinder A sorts 
ahead of cylinder B this time, they will likely sort the same way every time,
regardless of which direction the ray is coming from.  The first intersection 
that is found may or may not be "inside" the other plane, due to numerical 
inaccuracies.  If it is, it is kept.  If not, it's thrown away and the other 
intersection tested.  If the two planes have identical equations, the result 
of testing the other intersection will be identical to the first one.  So 
either the first intersection works, or neither one works.  If the first one 
works, you get a pixel colored like the first object.  If neither works, you 
go right through that face as if it didn't exist.  The result is a speckly 
surface where you expected something else.  If you're really lucky, the 
numerical inaccuracies may all go in your favor, leaving you with either a 
solid surface or a transparent one.  If you're extremely lucky, this will be 
the result you expected. :)

[1] intersection here does not mean CSG intersection.  It means "the place
where a ray hits an object."


Post a reply to this message

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