Skip to content

Commit

Permalink
ref(geometry): remove confusing operator*(quat,vec)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoszynski committed Dec 19, 2024
1 parent 14098e9 commit 311f82a
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions common/math/geometry/include/geometry/quaternion/operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,6 @@ auto operator*(const T & a, const U & b)
return v;
}

template <
typename T, typename U,
std::enable_if_t<std::conjunction_v<IsLikeQuaternion<T>, IsLikeVector3<U>>, std::nullptr_t> =
nullptr>
auto operator*(const T & rotation, const U & vector)
{
T vector_as_quaternion;
vector_as_quaternion.x = vector.x;
vector_as_quaternion.y = vector.y;
vector_as_quaternion.z = vector.z;
vector_as_quaternion.w = 0.0;

T inverse_rotation = rotation;
inverse_rotation.x = -rotation.x;
inverse_rotation.y = -rotation.y;
inverse_rotation.z = -rotation.z;
inverse_rotation.w = rotation.w;

T rotated_quaternion = rotation * vector_as_quaternion * inverse_rotation;

U rotated_vector;
rotated_vector.x = vector_as_quaternion.x;
rotated_vector.y = vector_as_quaternion.y;
rotated_vector.z = vector_as_quaternion.z;

return rotated_vector;
}

template <
typename T, typename U,
std::enable_if_t<std::conjunction_v<IsLikeQuaternion<T>, IsLikeQuaternion<U>>, std::nullptr_t> =
Expand Down

0 comments on commit 311f82a

Please sign in to comment.