ray vs capsule crashes with div/0 - is this a known bug, can anyone fix it?

28 views
Skip to first unread message

szu

unread,
Jun 30, 2011, 9:33:54 AM6/30/11
to ode-users
i'm attaching the minimal example.
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).
any ideas on how to fix it?


#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;
}
Reply all
Reply to author
Forward
0 new messages