mirror of
https://github.com/g-truc/glm.git
synced 2024-11-30 03:44:38 +00:00
Adding constexpr for dot, cross and inverse quaternion functions
This commit is contained in:
parent
a73987d863
commit
7eef79c9c7
@ -103,7 +103,7 @@ namespace glm
|
|||||||
/// @tparam T A floating-point scalar type
|
/// @tparam T A floating-point scalar type
|
||||||
/// @tparam Q A value from qualifier enum
|
/// @tparam Q A value from qualifier enum
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_DECL qua<T, Q> inverse(qua<T, Q> const& q);
|
GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> inverse(qua<T, Q> const& q);
|
||||||
|
|
||||||
/// Returns true if x holds a NaN (not a number)
|
/// Returns true if x holds a NaN (not a number)
|
||||||
/// representation in the underlying implementation's set of
|
/// representation in the underlying implementation's set of
|
||||||
|
@ -116,7 +116,7 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER qua<T, Q> inverse(qua<T, Q> const& q)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q> inverse(qua<T, Q> const& q)
|
||||||
{
|
{
|
||||||
return conjugate(q) / dot(q, q);
|
return conjugate(q) / dot(q, q);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see ext_quaternion_geometric
|
/// @see ext_quaternion_geometric
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_DECL T dot(qua<T, Q> const& x, qua<T, Q> const& y);
|
GLM_FUNC_DECL GLM_CONSTEXPR T dot(qua<T, Q> const& x, qua<T, Q> const& y);
|
||||||
|
|
||||||
/// Compute a cross product.
|
/// Compute a cross product.
|
||||||
///
|
///
|
||||||
@ -62,7 +62,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see ext_quaternion_geometric
|
/// @see ext_quaternion_geometric
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER qua<T, Q> cross(qua<T, Q> const& q1, qua<T, Q> const& q2);
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q> cross(qua<T, Q> const& q1, qua<T, Q> const& q2);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
} //namespace glm
|
} //namespace glm
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER T dot(qua<T, Q> const& x, qua<T, Q> const& y)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T dot(qua<T, Q> const& x, qua<T, Q> const& y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||||
return detail::compute_dot<qua<T, Q>, T, detail::is_aligned<Q>::value>::call(x, y);
|
return detail::compute_dot<qua<T, Q>, T, detail::is_aligned<Q>::value>::call(x, y);
|
||||||
@ -24,7 +24,7 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER qua<T, Q> cross(qua<T, Q> const& q1, qua<T, Q> const& q2)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q> cross(qua<T, Q> const& q1, qua<T, Q> const& q2)
|
||||||
{
|
{
|
||||||
return qua<T, Q>(
|
return qua<T, Q>(
|
||||||
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
|
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
|
||||||
|
Loading…
Reference in New Issue
Block a user