POV-Ray : Newsgroups : povray.general : Testing for intersection of two objects : Re: Testing for intersection of two objects Server Time
31 Jul 2024 22:12:45 EDT (-0400)
  Re: Testing for intersection of two objects  
From: Abe
Date: 24 Jul 2006 20:10:01
Message: <web.44c5602fc08fcd85131048ba0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it Abe who wrote:
> >"Mike the Elder" <zer### [at] wyanorg> wrote:
> >> Is there a reasonably simple way in POV-Ray to produce a Boolean value
> >> representing whether or no two objects intersect?  As in...
> >>
> >> #if ("object{Thing1} intersects object{Thing2}")
> >>       // STUFF TO DO IF THEY INTERSECT
> >> #else
> >>       // STUFF TO DO IF THEY DON'T INTERSECT
> >> #end
> >>
> >> I would very much appreciate if some kind soul could point out the section
> >> of the documentation and/or available resources that deal with this issue.
> >>
> >> Thanks in advance.
> >>
> >> Mike C.
> >
> >I was interested in your problem and did a couple of quick tests. Testing
> >min_extent and max_extent on two spheres known to intersect produced
> >predictable results. When the spheres did not intersect, the results for
> >the intersection object were as follows.
> >
> >min_extent = <-10000000000.000000,-10000000000.000000,-10000000000.000000>
> >max_extent = <10000000000.000000,10000000000.000000,10000000000.000000>
> >
> >So it looks like this could be used as a test, although I don't really know
> >how robust it is.
>
> POV calculates the intersection of the bounding boxes (because it can
> calculate that) and uses that as the bounding box for the intersection
> (which would be next to impossible to calculate in the general case).
>
> If you consider these non-intersecting spheres
> intersection {
>   sphere {0,1}
>   sphere {0,1 translate <1.2,1.2,1.2>}
>   pigment {rgb x}
> }
>
> Their bounding boxes do intersect at the corner, like this
> intersection {
>   box{-1,1}
>   box {-1,1 translate <1.2,1.2,1.2>}
>   pigment {rgb x}
> }
>
> So that method would be wrong in suggesting that the spheres
> intersected.
>
> --
> Mike Williams
> Gentleman of Leisure

Ha! An inconvenient exception. I think I'll choose to ignore it.
[retreats into own mental bounding box]


Post a reply to this message

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