Add and use BT_ID_* math functions for idScalar.

This commit is contained in:
Kibeom Kim
2017-01-26 10:59:14 -08:00
parent a230c941f9
commit 761275df28
6 changed files with 53 additions and 43 deletions

View File

@@ -226,10 +226,10 @@ int MultiBodyTree::addBody(int body_index, int parent_index, JointType joint_typ
warning_message(
"axis of motion not a unit axis ([%f %f %f]), will use normalized vector\n",
body_axis_of_motion(0), body_axis_of_motion(1), body_axis_of_motion(2));
idScalar length = std::sqrt(std::pow(body_axis_of_motion(0), 2) +
std::pow(body_axis_of_motion(1), 2) +
std::pow(body_axis_of_motion(2), 2));
if (length < std::sqrt(std::numeric_limits<idScalar>::min())) {
idScalar length = BT_ID_SQRT(BT_ID_POW(body_axis_of_motion(0), 2) +
BT_ID_POW(body_axis_of_motion(1), 2) +
BT_ID_POW(body_axis_of_motion(2), 2));
if (length < BT_ID_SQRT(std::numeric_limits<idScalar>::min())) {
error_message("axis of motion vector too short (%e)\n", length);
return -1;
}