fix portability of BulletInverseDynamics (usual issues: std::pow, M_PI, std::vector->idArray<T>::type, snprintf, pass vec3 and mat33 by const reference, not by value)
This commit is contained in:
@@ -5,6 +5,17 @@
|
||||
// If we have a custom configuration, compile without using other parts of bullet.
|
||||
#ifdef BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H
|
||||
#define BT_ID_WO_BULLET
|
||||
#define BT_ID_POW(a,b) std::pow(a,b)
|
||||
#define BT_ID_SNPRINTF snprintf
|
||||
#define BT_ID_PI M_PI
|
||||
#else
|
||||
#define BT_ID_POW(a,b) btPow(a,b)
|
||||
#define BT_ID_PI SIMD_PI
|
||||
#ifdef _WIN32
|
||||
#define BT_ID_SNPRINTF _snprintf
|
||||
#else
|
||||
#define BT_ID_SNPRINTF snprintf
|
||||
#endif //
|
||||
#endif
|
||||
// error messages
|
||||
#include "IDErrorMessages.hpp"
|
||||
|
||||
@@ -298,11 +298,11 @@ int MultiBodyTree::setBodyMass(const int body_index, idScalar mass) {
|
||||
return m_impl->setBodyMass(body_index, mass);
|
||||
}
|
||||
|
||||
int MultiBodyTree::setBodyFirstMassMoment(const int body_index, vec3 first_mass_moment) {
|
||||
int MultiBodyTree::setBodyFirstMassMoment(const int body_index, const vec3& first_mass_moment) {
|
||||
return m_impl->setBodyFirstMassMoment(body_index, first_mass_moment);
|
||||
}
|
||||
|
||||
int MultiBodyTree::setBodySecondMassMoment(const int body_index, mat33 second_mass_moment) {
|
||||
int MultiBodyTree::setBodySecondMassMoment(const int body_index, const mat33& second_mass_moment) {
|
||||
return m_impl->setBodySecondMassMoment(body_index, second_mass_moment);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,13 +250,13 @@ public:
|
||||
/// @param body_index index of the body
|
||||
/// @param first_mass_moment the vector to set
|
||||
/// @return 0 on success, -1 on failure
|
||||
int setBodyFirstMassMoment(const int body_index, const vec3 first_mass_moment);
|
||||
int setBodyFirstMassMoment(const int body_index, const vec3& first_mass_moment);
|
||||
/// set second moment of mass for a body
|
||||
/// (moment of inertia, in body fixed frame, relative to joint)
|
||||
/// @param body_index index of the body
|
||||
/// @param second_mass_moment the inertia matrix
|
||||
/// @return 0 on success, -1 on failure
|
||||
int setBodySecondMassMoment(const int body_index, const mat33 second_mass_moment);
|
||||
int setBodySecondMassMoment(const int body_index, const mat33& second_mass_moment);
|
||||
/// get mass for a body
|
||||
/// @param body_index index of the body
|
||||
/// @param mass the mass
|
||||
|
||||
@@ -792,13 +792,13 @@ int MultiBodyTree::MultiBodyImpl::setBodyMass(const int body_index, const idScal
|
||||
}
|
||||
|
||||
int MultiBodyTree::MultiBodyImpl::setBodyFirstMassMoment(const int body_index,
|
||||
const vec3 first_mass_moment) {
|
||||
const vec3& first_mass_moment) {
|
||||
CHECK_IF_BODY_INDEX_IS_VALID(body_index);
|
||||
m_body_list[body_index].m_body_mass_com = first_mass_moment;
|
||||
return 0;
|
||||
}
|
||||
int MultiBodyTree::MultiBodyImpl::setBodySecondMassMoment(const int body_index,
|
||||
const mat33 second_mass_moment) {
|
||||
const mat33& second_mass_moment) {
|
||||
CHECK_IF_BODY_INDEX_IS_VALID(body_index);
|
||||
m_body_list[body_index].m_body_I_body = second_mass_moment;
|
||||
return 0;
|
||||
|
||||
@@ -181,9 +181,9 @@ public:
|
||||
///\copydoc MultiBodytTree::setBodyMass
|
||||
int setBodyMass(const int body_index, const idScalar mass);
|
||||
///\copydoc MultiBodytTree::setBodyFirstMassMoment
|
||||
int setBodyFirstMassMoment(const int body_index, const vec3 first_mass_moment);
|
||||
int setBodyFirstMassMoment(const int body_index, const vec3& first_mass_moment);
|
||||
///\copydoc MultiBodytTree::setBodySecondMassMoment
|
||||
int setBodySecondMassMoment(const int body_index, const mat33 second_mass_moment);
|
||||
int setBodySecondMassMoment(const int body_index, const mat33& second_mass_moment);
|
||||
///\copydoc MultiBodytTree::getBodyMass
|
||||
int getBodyMass(const int body_index, idScalar* mass) const;
|
||||
///\copydoc MultiBodytTree::getBodyFirstMassMoment
|
||||
|
||||
Reference in New Issue
Block a user