void n_tentacle::bipolarityCheck(MQuaternion &quat1, MQuaternion &quat2) { // the quaternion's imaginary part can describe two rotations at the same time, // we make sure we always orient the two quaternions to the same direction double dot = (quat1.w * quat2.w) + (quat1.x * quat2.x) + (quat1.y * quat2.y) + (quat1.z * quat2.z); if(dot < 0.0) { quat1.negateIt(); } }