34 return (dGeomGetBody(_id) !=
nullptr);
39 return OdeBody(dGeomGetBody(_id));
44 dGeomSetBody(_id, body.
get_id());
55set_position(dReal x, dReal y, dReal z) {
56 dGeomSetPosition(_id, x, y, z);
60set_position(
const LVecBase3f &pos) {
61 set_position(pos[0], pos[1], pos[2]);
65set_rotation(
const LMatrix3f &r) {
66 dMatrix3 rot = { r(0, 0), r(0, 1), r(0, 2), 0,
67 r(1, 0), r(1, 1), r(1, 2), 0,
68 r(2, 0), r(2, 1), r(2, 2), 0 };
69 dGeomSetRotation(_id, rot);
73set_quaternion(
const LQuaternionf &q) {
74 dQuaternion quat = { q[0], q[1], q[2], q[3] };
75 dGeomSetQuaternion(_id, quat);
78INLINE LPoint3f OdeGeom::
80 const dReal *pos = dGeomGetPosition(_id);
81 return LPoint3f(pos[0], pos[1], pos[2]);
84INLINE LMatrix3f OdeGeom::
86 const dReal *rot = dGeomGetRotation(_id);
87 return LMatrix3f(rot[0], rot[1], rot[2],
88 rot[4], rot[5], rot[6],
89 rot[8], rot[9], rot[10]);
92INLINE LQuaternionf OdeGeom::
93get_quaternion()
const {
95 dGeomGetQuaternion(_id, res);
96 return LQuaternionf(res[0], res[1], res[2], res[3]);
100get_AABB(LVecBase3f &min, LVecBase3f &max)
const {
102 dGeomGetAABB(_id, result);
103 min.set(result[0], result[2], result[4]);
104 max.set(result[1], result[3], result[5]);
109 return dGeomIsSpace(_id);
114 return dGeomGetClass(_id);
118set_category_bits(
const BitMask32 &bits) {
119 dGeomSetCategoryBits(_id, bits.
get_word());
124 dGeomSetCollideBits(_id, bits.
get_word());
129 return BitMask32(dGeomGetCategoryBits(_id));
134 return BitMask32(dGeomGetCollideBits(_id));
149 return dGeomIsEnabled(_id);
153set_offset_position(dReal x, dReal y, dReal z) {
154 dGeomSetOffsetPosition(_id, x, y, z);
158set_offset_position(
const LVecBase3f &pos) {
159 set_offset_position(pos[0], pos[1], pos[2]);
163set_offset_rotation(
const LMatrix3f &r) {
164 dMatrix3 rot = { r(0, 0), r(0, 1), r(0, 2), 0,
165 r(1, 0), r(1, 1), r(1, 2), 0,
166 r(2, 0), r(2, 1), r(2, 2), 0 };
167 dGeomSetOffsetRotation(_id, rot);
171set_offset_quaternion(
const LQuaternionf &q) {
172 dQuaternion quat = { q[0], q[1], q[2], q[3] };
173 dGeomSetOffsetQuaternion(_id, quat);
177set_offset_world_position(dReal x, dReal y, dReal z) {
178 dGeomSetOffsetWorldPosition(_id, x, y, z);
182set_offset_world_position(
const LVecBase3f &pos) {
183 set_offset_world_position(pos[0], pos[1], pos[2]);
187set_offset_world_rotation(
const LMatrix3f &r) {
188 dMatrix3 rot = { r(0, 0), r(0, 1), r(0, 2), 0,
189 r(1, 0), r(1, 1), r(1, 2), 0,
190 r(2, 0), r(2, 1), r(2, 2), 0 };
191 dGeomSetOffsetWorldRotation(_id, rot);
195set_offset_world_quaternion(
const LQuaternionf &q) {
196 dQuaternion quat = { q[0], q[1], q[2], q[3] };
197 dGeomSetOffsetWorldQuaternion(_id, quat);
202 dGeomClearOffset(_id);
207 return dGeomIsOffset(_id);
210INLINE LPoint3f OdeGeom::
211get_offset_position()
const {
212 const dReal *pos = dGeomGetOffsetPosition(_id);
213 return LPoint3f(pos[0], pos[1], pos[2]);
216INLINE LMatrix3f OdeGeom::
217get_offset_rotation()
const {
218 const dReal *rot = dGeomGetOffsetRotation(_id);
219 return LMatrix3f(rot[0], rot[1], rot[2],
220 rot[4], rot[5], rot[6],
221 rot[8], rot[9], rot[10]);
224INLINE LQuaternionf OdeGeom::
225get_offset_quaternion()
const {
227 dGeomGetOffsetQuaternion(_id, res);
228 return LQuaternionf(res[0], res[1], res[2], res[3]);
232compare_to(
const OdeGeom &other)
const {
233 if (_id != other._id) {
234 return _id < other._id ? -1 : 1;
WordType get_word() const
Returns the entire BitMask as a single word.
dBodyID get_id() const
Returns the underlying dBodyID.
bool is_empty() const
Returns true if the ID is 0, meaning the OdeGeom does not point to a valid geom.
dGeomID get_id() const
Returns the underlying dGeomID.