|
![](/i/fill.gif) |
On 01/25/2013 10:00 PM, Christian Froeschlin wrote:
> Lars R. wrote:
>
>> But it is possible that 2 cubes intersects even if none of the corners
>> is inside of the other cube. :-(
>
> I haven't really thought this through, but I think most of these
> cases could be avoided by also checking the center points.
Also thinking aloud, if you are not after the best "packing" of
arbitrarily rotated cubes, what Christian suggests should work I think
as any given rotated cube would fit inside a sphere with a radius of
magnitude equal to the distance from the cube's center to one of its
corners. In other words, you could put arbitrarily rotated cubes inside
each of your placed spheres and they would not intersect, so long as
your spheres did not intersect.
That said, it is not apparent from your cube intersection pseudo code
whether you are handling the inverse rotation adjustments into each
adjacent cubes coordinate space - something at which Trevor was hinting
in his outline.
Supposing you are handling rotations, I suspect the issue is your test
needs to be symmetrical on each placement of a cube. Meaning it is not
enough to test the current cubes corners are not inside adjacent cubes.
It is also necessary to test that corners of all "adjacent" cubes are
not inside the cube being placed.
Here "adjacent" cubes would be something like all those cubes with
smallest containing spheres intersecting the smallest containing sphere
of the cube you are placing.
Bill P.
Post a reply to this message
|
![](/i/fill.gif) |