[DEBUG] correct quaternion point implementation

This commit is contained in:
Edouard DUPIN 2017-10-02 23:27:27 +02:00
parent 5cfe846830
commit 86dd643a6c

View File

@ -131,9 +131,9 @@ namespace etk {
*/ */
Quaternion operator*(const float& _val) const { Quaternion operator*(const float& _val) const {
return Quaternion(m_floats[0] * _val, return Quaternion(m_floats[0] * _val,
m_floats[1] * _val, m_floats[1] * _val,
m_floats[2] * _val, m_floats[2] * _val,
m_floats[3] * _val); m_floats[3] * _val);
} }
/** /**
* @brief Inversely scale the quaternion * @brief Inversely scale the quaternion
@ -427,9 +427,12 @@ namespace etk {
* @return Point with the updated position * @return Point with the updated position
*/ */
vec3 operator*(const vec3& _point) const { vec3 operator*(const vec3& _point) const {
// TODO :Xheck this ==> if seams a little complicated ... vec3 qvec = getVectorV();
Quaternion p(0.0, _point); vec3 uv = qvec.cross(_point);
return (((*this) * p) * getConjugate()).getVectorV(); vec3 uuv = qvec.cross(uv);
uv *= (2.0f * m_floats[3]);
uuv *= 2.0f;
return _point + uv + uuv;
} }
/** /**
* @brief Set each element to the max of the current values and the values of another Vector * @brief Set each element to the max of the current values and the values of another Vector