17 dReal OdeUtil::OC_infinity = dInfinity;
37 const int max_possible_joints = min(body1.get_num_joints(), body1.get_num_joints());
39 dJointID *joint_list = (dJointID *)PANDA_MALLOC_ARRAY(max_possible_joints *
sizeof(dJointID));
40 int num_joints = dConnectingJointList(body1.
get_id(), body2.
get_id(),
43 for (
int i = 0; i < num_joints; i++) {
44 joints.add_joint(
OdeJoint(joint_list[i]));
47 PANDA_FREE_ARRAY(joint_list);
77 const int joint_type) {
78 return dAreConnectedExcluding(body1.
get_id(),
91 collide(const
OdeGeom &geom1, const
OdeGeom &geom2, const
short int max_contacts) {
92 dContactGeom *contact_list = (dContactGeom *)PANDA_MALLOC_ARRAY(max_contacts *
sizeof(dContactGeom));
93 int num_contacts = dCollide(geom1.get_id(), geom2.get_id(), max_contacts, contact_list,
sizeof(dContactGeom));
95 entry->_geom1 = geom1.
get_id();
96 entry->_geom2 = geom2.get_id();
97 entry->_body1 = dGeomGetBody(geom1.get_id());
98 entry->_body2 = dGeomGetBody(geom2.get_id());
99 entry->_num_contacts = num_contacts;
101 for (
int i = 0; i < num_contacts; i++) {
102 entry->_contact_geoms[i] = contact_list[i];
105 PANDA_FREE_ARRAY(contact_list);
110 space_to_geom(
const OdeSpace &space) {
A class used to hold information about a collision that has occurred.
dSpaceID get_id() const
Returns the underlying dSpaceID.
static OdeJoint get_connecting_joint(const OdeBody &body1, const OdeBody &body2)
Returns the joint that connects the given bodies.
dBodyID get_id() const
Returns the underlying dBodyID.
static int are_connected(const OdeBody &body1, const OdeBody &body2)
Returns 1 if the given bodies are connected by a joint, returns 0 otherwise.
static OdeJointCollection get_connecting_joint_list(const OdeBody &body1, const OdeBody &body2)
Returns a collection of joints connecting the specified bodies.
dJointID get_id() const
Returns the underlying dJointID.
static int are_connected_excluding(const OdeBody &body1, const OdeBody &body2, const int joint_type)
Returns 1 if the given bodies are connected by a joint that does not match the given joint_type...