424 Chapter 8 Collision Detection
the return value of the function is
true. The set must itself be convex. The number
of vertices in the set is stored in
quantity and the vertices, in counterclockwise order,
are stored in the array
I[].Ifthereturnvalueisfalse, the last two arguments of the
function are invalid and should not be used.
bool FindIntersection (ConvexPolygon C0, Vector V0,
ConvexPolygon C1, Vector W1, double tmax, double& tfirst,
double& tlast, int& quantity, Point I[])
{
ProjInfo info0, info1, curr0, curr1;
// Process as if C0 were stationary and C1 were moving.
V=V1-V0;
tfirst = 0;
tlast = INFINITY;
// Process edges of C0.
for (i0 = C0.GetN() - 1, i1 = 0; i1 < C0.GetN(); i0 = i1++)
{
D = C0.GetNormal(i0);
ComputeInterval(C0,D,info0);
ComputeInterval(C1,D,info1); ...