Code review feedback

* Removed AnimPose::fuzzyEqual
* Fixed DualQuaternion ctor
This commit is contained in:
Anthony J. Thibault 2018-01-08 13:19:54 -08:00
parent 59b843781e
commit d08f94a74d
3 changed files with 1 additions and 24 deletions

View file

@ -69,27 +69,6 @@ AnimPose AnimPose::mirror() const {
return AnimPose(_scale, glm::quat(_rot.w, _rot.x, -_rot.y, -_rot.z), glm::vec3(-_trans.x, _trans.y, _trans.z));
}
bool AnimPose::fuzzyEqual(const AnimPose& rhs) const {
const float SCALE_EPSILON = 0.00001f;
const float ROT_EPSILON = 0.00001f;
const float TRANS_EPSILON = 0.001f;
if ((fabsf(rhs._scale.x - _scale.x) < SCALE_EPSILON) &&
(fabsf(rhs._scale.y - _scale.y) < SCALE_EPSILON) &&
(fabsf(rhs._scale.z - _scale.z) < SCALE_EPSILON)) {
if ((fabsf(rhs._rot.x - _rot.x) < ROT_EPSILON) &&
(fabsf(rhs._rot.y - _rot.y) < ROT_EPSILON) &&
(fabsf(rhs._rot.z - _rot.z) < ROT_EPSILON) &&
(fabsf(rhs._rot.w - _rot.w) < ROT_EPSILON)) {
if ((fabsf(rhs._trans.x - _trans.x) < TRANS_EPSILON) &&
(fabsf(rhs._trans.y - _trans.y) < TRANS_EPSILON) &&
(fabsf(rhs._trans.z - _trans.z) < TRANS_EPSILON)) {
return true;
}
}
}
return false;
}
AnimPose::operator glm::mat4() const {
glm::vec3 xAxis = _rot * glm::vec3(_scale.x, 0.0f, 0.0f);
glm::vec3 yAxis = _rot * glm::vec3(0.0f, _scale.y, 0.0f);

View file

@ -46,8 +46,6 @@ public:
const glm::vec3& trans() const { return _trans; }
glm::vec3& trans() { return _trans; }
bool fuzzyEqual(const AnimPose& rhs) const;
private:
friend QDebug operator<<(QDebug debug, const AnimPose& pose);
glm::vec3 _scale { 1.0f };

View file

@ -28,7 +28,7 @@ DualQuaternion::DualQuaternion(const glm::vec4& real, const glm::vec4& imag) :
DualQuaternion::DualQuaternion(const glm::quat& rotation, const glm::vec3& translation) {
_real = rotation;
_imag = glm::quat(0, 0.5f * translation.x, 0.5f * translation.y, 0.5f * translation.z) * rotation;
_imag = glm::quat(0.0f, 0.5f * translation.x, 0.5f * translation.y, 0.5f * translation.z) * rotation;
}
DualQuaternion DualQuaternion::operator*(const DualQuaternion& rhs) const {