POV-Ray : Newsgroups : povray.advanced-users : Colision testing ? : Re: Colision testing ? Server Time
29 Jul 2024 12:21:21 EDT (-0400)
  Re: Colision testing ?  
From: Christopher James Huff
Date: 23 Apr 2002 12:28:31
Message: <pan.2002.04.23.11.30.42.551423.823@mac.com>


> probably it is not the fastest but rather simplest to explain method: 1.
> create and set location for both sets of objects 2. perform
> intersection{} on them
> 3. use VRand_In_Obj() to find any point in object if returned point
> isn't inside intersection then you can be almost sure they not overlap

A faster way would be to write a special macro that does this:
Check if the bounding boxes overlap. If they overlap, get the
intersection of both shapes and start looking for a random point inside
the intersection's bounding box which is also inside the intersection.
If you find one, the boxes intersect. Give up after a certain (large)
number of tries. You could use the VRand_In_Obj() macro as a base for
this.
Of course, this won't work for objects which don't have insides, such as
triangles, meshes, and bezier patches. You would have to write special
macros to handle those.


-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: <chr### [at] tagpovrayorg>
WWW: http://homepage.mac.com/chrishuff/


Post a reply to this message

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