Ray vs capsule crashes with div/0
Issue #26
resolved
Usually this problem is hidden in linux, because of the default fpu flags that ignore div/0 (my example code adjusts the fpu to make it fatal in linux, too).
Is this a real bug or something is wrong with my code, or maybe that's how ODE handles certain situations and you should always disable div/0 exceptions?
#include <ode/ode.h>
#include <fenv.h>
void rayCallback(void *data, dGeomID o1, dGeomID o2)
{
dContactGeom contact;
if (dCollide(o1,o2,1,&contact,sizeof(dContactGeom)))
printf("contact! %g",contact.depth);
}
int main()
{
feenableexcept(FE_DIVBYZERO);
dInitODE();
dSpaceID space;
dGeomID ray;
dGeomID cyl;
space = dHashSpaceCreate(0);
cyl = dCreateCCylinder (space, 0.1, 1);
dMatrix3 R={0,0,1,0, 1,0,0,0, 0,1,0,0};
dGeomSetPosition(cyl,0,0,0);
dGeomSetRotation(cyl,R);
ray = dCreateRay(space,1);
dGeomRaySet(ray, 0,0,0, 1,0,0);
dSpaceCollide2(ray,(dGeomID)space,0,rayCallback);
dCloseODE();
return 0;
}
Comments (4)
-
-
Account Deactivated Fixed in revision #1899
-
Account Deactivated - changed status to resolved
-
Account Deleted Well done! Thank you, Oleh!
- Log in to comment
This was submitted back in 2011 https://groups.google.com/forum/#!topic/ode-users/upyGw-V8cn0 and still exists in the most recent ODE 0.13.1.
Especially annoying under Windows, as it results in an app crash or an exception thrown.
Not sure if I remember correctly and if this is related... somewhere in ODE sources something like #define INFINITY 1.0/0.0 ?