danfis / libccd

Library for collision detection between two convex shapes
Other
478 stars 108 forks source link

direction passed to __ccdSupport() not normalized #3

Closed martinfelis closed 11 years ago

martinfelis commented 11 years ago

In src/ccd.c:323 it is likely to happen that the direction that is passed as the 3rd argument is not properly normalized. From the rest of the code it seems as if this not intended.

Adding a

      ccdVec3dNormalize(&dir);

in line 323 fixes it.

danfis commented 11 years ago

The direction really isn't normalized but it is not necessary to have direction normalized. For one example, if you need to get next support point in a box shaped object you only need to know a sign of each component. It is responsibility of the user-provided support function to normalize the direction vector if it needs it. For performance reasons I will use the current implementation without normalization.