next up previous contents
Next: Detecting Danger of Collision with Up: An Example: Collision Detection Previous: An Example: Collision Detection

Detecting Danger of Collision with Cylindrical Obstacles

Fig. gif shows several swimming fishes avoiding collisions with cylindrical obstacles. The collision test against a visible cylinder C is performed using similar algorithms to those used for the occlusion test. We define a ray along the fish's local x-axis tex2html_wrap_inline2962 which starts at the cyclopean origin O and ends at point Q. One can imagine ray tex2html_wrap_inline3338 as an ``antenna'' of the fish that detects potential danger of collision. The length of tex2html_wrap_inline3338 defines the range of detection (in our implementation, we set this length to be the fish's body length). Taking into account the fish's body width tex2html_wrap_inline3342 , we perform the collision test against radius tex2html_wrap_inline3344 instead of r (r is the radius of C). The pseudo code for this test is as follows ( tex2html_wrap_inline3352 , tex2html_wrap_inline3354 and h are defined as in the occlusion test algorithm):

if (OQ intersects with the boundary of C) { 
                              // there may be a threat of collision.
   fh := body height of fish; 
   if (min[z1, z2] < h + fh)  // check if fish is well above C.
     return(threat of collision);
   else
     return(no threat of collision);
} else
   return(no threat of collision);
If threat of collision is detected from more than one static obstacles, the one whose boundary is closest to the fish's cyclopean origin is regarded as the most dangerous obstacle.


next up previous contents
Next: Detecting Danger of Collision with Up: An Example: Collision Detection Previous: An Example: Collision Detection
Xiaoyuan TuJanuary 1996