[ODE] Collision Trimesh-Box
Oleh Derevenko
oder at eleks.lviv.ua
Tue Aug 14 05:14:42 MST 2007
Hi
>> What happens if you reverse the winding of all the faces?
> No. That does not help.
So, the reason was quite simple. Having believed the comment for dCollide,
-----------------------------
* @param flags The flags specify how contacts should be generated if
* the geoms touch. The lower 16 bits of flags is an integer that
* specifies the maximum number of contact points to generate. Note
* that if this number is zero, this function just pretends that it is
* one -- in other words you can not ask for zero contacts. All other bits
* in flags must be zero. In the future the other bits may be used to
* select from different contact generation strategies.
-----------------------------
which says that is flags is zero the function pretends it is one, I had made
a mistake because this is a complete bullshit and there is no special
processing of zero-value in the code. If flags is zero the function always
returns zero contacts.
Also, in GenerateContact() of collision_trimesh_box.cpp there is a cycle
for (int i=0; i<OutTriCount; i++)
which checks for matches with normals already generated. Why does not it
bail out after the match has been found and continues checking all the rest
contacts? Is not it one of the first optimization principles every student
starting to write programs should know?
Or the same thing in dCollideBTL() of collision_trimesh_box.cpp. If all the
available contact return slots are already assigned, why the function
continues executing cycle
for (int i = 0; i < TriCount; i++){
checking triangles and calculating intersections just to see every next time
that there is no more room left to store result and just to ignore that
result after all?
It's really sad to see code like that. :(
Oleh Derevenko
More information about the ODE
mailing list