16 dReal OdeUtil::OC_infinity = dInfinity;
31 const int max_possible_joints = std::min(body1.get_num_joints(), body1.get_num_joints());
33 dJointID *joint_list = (dJointID *)PANDA_MALLOC_ARRAY(max_possible_joints *
sizeof(dJointID));
34 int num_joints = dConnectingJointList(body1.
get_id(), body2.
get_id(),
37 for (
int i = 0; i < num_joints; i++) {
38 joints.add_joint(
OdeJoint(joint_list[i]));
41 PANDA_FREE_ARRAY(joint_list);
65 const int joint_type) {
66 return dAreConnectedExcluding(body1.
get_id(),
76 collide(
const OdeGeom &geom1,
const OdeGeom &geom2,
const short int max_contacts) {
77 dContactGeom *contact_list = (dContactGeom *)PANDA_MALLOC_ARRAY(max_contacts *
sizeof(dContactGeom));
78 int num_contacts = dCollide(geom1.
get_id(), geom2.
get_id(), max_contacts, contact_list,
sizeof(dContactGeom));
80 entry->_geom1 = geom1.
get_id();
81 entry->_geom2 = geom2.
get_id();
82 entry->_body1 = dGeomGetBody(geom1.
get_id());
83 entry->_body2 = dGeomGetBody(geom2.
get_id());
84 entry->_num_contacts = num_contacts;
86 for (
int i = 0; i < num_contacts; i++) {
87 entry->_contact_geoms[i] = contact_list[i];
90 PANDA_FREE_ARRAY(contact_list);
95 space_to_geom(
const OdeSpace &space) {
dSpaceID get_id() const
Returns the underlying dSpaceID.
dGeomID get_id() const
Returns the underlying dGeomID.
A class used to hold information about a collision that has occurred.
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.
PT(OdeCollisionEntry) OdeUtil
Given two geometry objects that potentially touch (geom1 and geom2), generate contact information for...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...