POV-Ray : Newsgroups : povray.binaries.images : Hollow sphere, filled with shperes : Re: Hollow sphere, filled with shperes Server Time
30 Jul 2024 02:14:22 EDT (-0400)
  Re: Hollow sphere, filled with shperes  
From: clipka
Date: 26 Jan 2013 15:57:08
Message: <51044324$1@news.povray.org>
Am 26.01.2013 16:10, schrieb William F Pokorny:
> On 01/26/2013 08:56 AM, clipka wrote:
>>
>> Not a formula, but an algorithm:
>>
>> (0) [optional, just for speed] If the cubes' bounding boxes don't
>> intersect, the cubes don't intersect.
>>
>> (1) If any corner of the smaller cube is inside the larger cube, they
>> intersect. (No need to test the other way round.)
>>
>> (2) If any edge of the smaller cube intersects any surface of the larger
>> cube, they intersect. (Again no need to test the other way round.)
>>
>> (3) In any other case, they don't intersect.
>>
>>
>> Note that this only works for cubes, not for generic boxes.
>>
> Hi Christoph,
> I'm likely missing some detail here as I do not follow the reason for
> larger and smaller naming. In any case, I am wondering in your outline
> about the case where a corner of the "larger" cube pokes through the
> surface of the smaller cube?

Damn, you're bloody well right - I didn't think of that.

The reasoning for the larger/smaller cube thing was primarily for the 
case that one cube is contained entirely within the other, which is the 
only reason (or so I thought) to include test (1) at all. Obviously, 
only the smaller cube can be contained entirely within the larger, not 
vice versa. I just took the same naming for (2) as well, rather than use 
"cube A" and "cube B" there.

But yes, we need a 2.5:

(2.5a) If any corner of the larger cube is inside the smaller cube, they 
intersect.

-or-

(2.5b) If any edge of the larger cube intersects any surface of the 
smaller cube, they intersect.


Post a reply to this message

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