Fig.
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
which starts at the cyclopean origin O and ends at
point Q. One can imagine ray
as an ``antenna'' of
the fish that detects potential danger of collision. The length of
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
, we perform the collision test against
radius
instead of r (r is the radius of C). The
pseudo code for this test is as follows (
,
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.
| Xiaoyuan Tu | January 1996 |