The latest V-Collide source code, version 1.1, was released on Feb 1, 1998. The C++ code is available in both zipped tar format (1561K) and ZIP (1614K). It contains source code for the collision detection libraries, brief documentation, and several sample applications, and is freely available for non-commercial use. If you put it to good use, let us know about it.
The is absolutely no difference between the APIs for versions 1.0 and versions 1.1. The only difference is in the internal implementation of one of the NBody routines, as a result of which version 1.1 is more robust than version 1.0.
Compiler | Operating Systems |
g++ 2.7.x |
SGI Irix 6.2 HPUX VERSION Solaris 5.5.1 |
CC |
SGI Irix 6.2 HPUX VERSION Solaris 5.5.1 |
In VInternal.C, VCInternal::Collide
//collision report database.
if (RAPID_num_contacts != 0)
report_data.AddPair(i, vc_objects[curr_ovrlp->id]->id);
This fragment records the IDs of the pair of objects. You will need to augment this with the IDs of the triangles on each object. (Since RAPID detects multiple contacts if you change the preceeding call to ::Collide from FIRST_CONTACT to ALL_CONTACTS, you may want to generalize this to a loop if you're doing physical simulation)
int i;
for (i = 0; i < RAPID_num_contacts; i++)
report_data.AddPair(i, RAPID_contact[i].id1,
vc_objects[curr_ovrlp->id]->id,
RAPID_contact[i].id2);
This gives you (object #1, triangle on object #1, object #2, ...) for all detected contacts. Of course, this means you need to redefine class PairData. PairData is a sparse array of the colliding pairs. The correct thing to do is probably to put a linked list of pairs of triagle IDs on class Elem, and maintain that in AddPair.
Finally, redefine VCReportType to contain two triangle IDs, and
in VCInternal::Report() fill those in from report_data.arr[]. This
requires changing the for loop. (If you are only detecting FIRST_CONTACT
control flow is simpler here.)
Copyright 1997.