Ray vs capsule crashes with div/0

Issue #26 resolved
Former user created an issue

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)

  1. Log in to comment