40 return (dGeomGetBody(_id) != NULL);
45 return OdeBody(dGeomGetBody(_id));
50 dGeomSetBody(_id, body.
get_id());
61 set_position(dReal x, dReal y, dReal z) {
62 dGeomSetPosition(_id, x, y, z);
67 set_position(pos[0], pos[1], pos[2]);
72 dMatrix3 rot = { r(0, 0), r(0, 1), r(0, 2), 0,
73 r(1, 0), r(1, 1), r(1, 2), 0,
74 r(2, 0), r(2, 1), r(2, 2), 0 };
75 dGeomSetRotation(_id, rot);
80 dQuaternion quat = { q[0], q[1], q[2], q[3] };
81 dGeomSetQuaternion(_id, quat);
85 get_position()
const {
86 const dReal *pos = dGeomGetPosition(_id);
87 return LPoint3f(pos[0], pos[1], pos[2]);
91 get_rotation()
const {
92 const dReal *rot = dGeomGetRotation(_id);
94 rot[4], rot[5], rot[6],
95 rot[8], rot[9], rot[10]);
99 get_quaternion()
const {
101 dGeomGetQuaternion(_id, res);
105 INLINE
void OdeGeom::
108 dGeomGetAABB(_id, result);
109 min.set(result[0], result[2], result[4]);
110 max.set(result[1], result[3], result[5]);
115 return dGeomIsSpace(_id);
120 return dGeomGetClass(_id);
123 INLINE
void OdeGeom::
124 set_category_bits(
const BitMask32 &bits) {
125 dGeomSetCategoryBits(_id, bits.
get_word());
128 INLINE
void OdeGeom::
129 set_collide_bits(
const BitMask32 &bits) {
130 dGeomSetCollideBits(_id, bits.
get_word());
134 get_category_bits() {
135 return BitMask32(dGeomGetCategoryBits(_id));
140 return BitMask32(dGeomGetCollideBits(_id));
143 INLINE
void OdeGeom::
148 INLINE
void OdeGeom::
155 return dGeomIsEnabled(_id);
158 INLINE
void OdeGeom::
159 set_offset_position(dReal x, dReal y, dReal z) {
160 dGeomSetOffsetPosition(_id, x, y, z);
163 INLINE
void OdeGeom::
165 set_offset_position(pos[0], pos[1], pos[2]);
168 INLINE
void OdeGeom::
169 set_offset_rotation(
const LMatrix3f &r) {
170 dMatrix3 rot = { r(0, 0), r(0, 1), r(0, 2), 0,
171 r(1, 0), r(1, 1), r(1, 2), 0,
172 r(2, 0), r(2, 1), r(2, 2), 0 };
173 dGeomSetOffsetRotation(_id, rot);
176 INLINE
void OdeGeom::
178 dQuaternion quat = { q[0], q[1], q[2], q[3] };
179 dGeomSetOffsetQuaternion(_id, quat);
182 INLINE
void OdeGeom::
183 set_offset_world_position(dReal x, dReal y, dReal z) {
184 dGeomSetOffsetWorldPosition(_id, x, y, z);
187 INLINE
void OdeGeom::
188 set_offset_world_position(
const LVecBase3f &pos) {
189 set_offset_world_position(pos[0], pos[1], pos[2]);
192 INLINE
void OdeGeom::
193 set_offset_world_rotation(
const LMatrix3f &r) {
194 dMatrix3 rot = { r(0, 0), r(0, 1), r(0, 2), 0,
195 r(1, 0), r(1, 1), r(1, 2), 0,
196 r(2, 0), r(2, 1), r(2, 2), 0 };
197 dGeomSetOffsetWorldRotation(_id, rot);
200 INLINE
void OdeGeom::
202 dQuaternion quat = { q[0], q[1], q[2], q[3] };
203 dGeomSetOffsetWorldQuaternion(_id, quat);
206 INLINE
void OdeGeom::
208 dGeomClearOffset(_id);
213 return dGeomIsOffset(_id);
217 get_offset_position()
const {
218 const dReal *pos = dGeomGetOffsetPosition(_id);
219 return LPoint3f(pos[0], pos[1], pos[2]);
223 get_offset_rotation()
const {
224 const dReal *rot = dGeomGetOffsetRotation(_id);
226 rot[4], rot[5], rot[6],
227 rot[8], rot[9], rot[10]);
231 get_offset_quaternion()
const {
233 dGeomGetOffsetQuaternion(_id, res);
238 compare_to(
const OdeGeom &other)
const {
239 if (_id != other._id) {
240 return _id < other._id ? -1 : 1;
This is the base class for all three-component vectors and points.
bool is_empty() const
Returns true if the ID is 0, meaning the OdeGeom does not point to a valid geom.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
dGeomID get_id() const
Returns the underlying dGeomID.
WordType get_word() const
Returns the entire BitMask as a single word.
dBodyID get_id() const
Returns the underlying dBodyID.
This is the base quaternion class.
This is a 3-by-3 transform matrix.