diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-21 17:40:38 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-21 17:40:38 +0200 |
commit | 2877f4eda3d1b0c7431039e3142ecf1a282a34b1 (patch) | |
tree | 58ad35e27ab2a3b8955f5adbf28f296670681ffc /external/include/glm/gtx/dual_quaternion.hpp | |
parent | Smooth sun movement (diff) | |
download | AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.gz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.bz2 AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.lz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.xz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.zst AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.zip |
Diffstat (limited to 'external/include/glm/gtx/dual_quaternion.hpp')
-rw-r--r-- | external/include/glm/gtx/dual_quaternion.hpp | 162 |
1 files changed, 85 insertions, 77 deletions
diff --git a/external/include/glm/gtx/dual_quaternion.hpp b/external/include/glm/gtx/dual_quaternion.hpp index 4d7b61e..5544514 100644 --- a/external/include/glm/gtx/dual_quaternion.hpp +++ b/external/include/glm/gtx/dual_quaternion.hpp @@ -3,16 +3,15 @@ /// @author Maksim Vorobiev (msomeone@gmail.com) /// /// @see core (dependence) -/// @see gtc_half_float (dependence) /// @see gtc_constants (dependence) /// @see gtc_quaternion (dependence) /// /// @defgroup gtx_dual_quaternion GLM_GTX_dual_quaternion /// @ingroup gtx /// -/// @brief Defines a templated dual-quaternion type and several dual-quaternion operations. +/// Include <glm/gtx/dual_quaternion.hpp> to use the features of this extension. /// -/// <glm/gtx/dual_quaternion.hpp> need to be included to use these functionalities. +/// Defines a templated dual-quaternion type and several dual-quaternion operations. #pragma once @@ -21,6 +20,10 @@ #include "../gtc/constants.hpp" #include "../gtc/quaternion.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_dual_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_dual_quaternion extension included") #endif @@ -30,192 +33,197 @@ namespace glm /// @addtogroup gtx_dual_quaternion /// @{ - template <typename T, precision P = defaultp> + template<typename T, qualifier Q = defaultp> struct tdualquat { // -- Implementation detail -- typedef T value_type; - typedef glm::tquat<T, P> part_type; + typedef glm::tquat<T, Q> part_type; // -- Data -- - glm::tquat<T, P> real, dual; + glm::tquat<T, Q> real, dual; // -- Component accesses -- typedef length_t length_type; /// Return the count of components of a dual quaternion - GLM_FUNC_DECL static length_type length(){return 2;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;} GLM_FUNC_DECL part_type & operator[](length_type i); - GLM_FUNC_DECL part_type const & operator[](length_type i) const; + GLM_FUNC_DECL part_type const& operator[](length_type i) const; // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT; - template <precision Q> - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const & d); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const& d) GLM_DEFAULT; + template<qualifier P> + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const& d); // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tdualquat(ctor); - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real); - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & orientation, tvec3<T, P> const & translation); - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, Q> const& real); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, Q> const& orientation, vec<3, T, Q> const& translation); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, Q> const& real, tquat<T, Q> const& dual); // -- Conversion constructors -- - template <typename U, precision Q> - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q); + template<typename U, qualifier P> + GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat<U, P> const& q); - GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4<T, P> const & holder_mat); - GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4<T, P> const & aug_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(mat<2, 4, T, Q> const& holder_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(mat<3, 4, T, Q> const& aug_mat); // -- Unary arithmetic operators -- - GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m) GLM_DEFAULT; + GLM_FUNC_DECL tdualquat<T, Q> & operator=(tdualquat<T, Q> const& m) GLM_DEFAULT; - template <typename U> - GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<U, P> const & m); - template <typename U> - GLM_FUNC_DECL tdualquat<T, P> & operator*=(U s); - template <typename U> - GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s); + template<typename U> + GLM_FUNC_DECL tdualquat<T, Q> & operator=(tdualquat<U, Q> const& m); + template<typename U> + GLM_FUNC_DECL tdualquat<T, Q> & operator*=(U s); + template<typename U> + GLM_FUNC_DECL tdualquat<T, Q> & operator/=(U s); }; // -- Unary bit operators -- - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator+(tdualquat<T, Q> const& q); - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator-(tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator-(tdualquat<T, Q> const& q); // -- Binary operators -- - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q, tdualquat<T, P> const & p); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator+(tdualquat<T, Q> const& q, tdualquat<T, Q> const& p); - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, tdualquat<T, P> const & p); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator*(tdualquat<T, Q> const& q, tdualquat<T, Q> const& p); - template <typename T, precision P> - GLM_FUNC_DECL tvec3<T, P> operator*(tdualquat<T, P> const & q, tvec3<T, P> const & v); + template<typename T, qualifier Q> + GLM_FUNC_DECL vec<3, T, Q> operator*(tdualquat<T, Q> const& q, vec<3, T, Q> const& v); - template <typename T, precision P> - GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, tdualquat<T, Q> const& q); - template <typename T, precision P> - GLM_FUNC_DECL tvec4<T, P> operator*(tdualquat<T, P> const & q, tvec4<T, P> const & v); + template<typename T, qualifier Q> + GLM_FUNC_DECL vec<4, T, Q> operator*(tdualquat<T, Q> const& q, vec<4, T, Q> const& v); - template <typename T, precision P> - GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, tdualquat<T, Q> const& q); - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, T const & s); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator*(tdualquat<T, Q> const& q, T const& s); - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator*(T const & s, tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator*(T const& s, tdualquat<T, Q> const& q); - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> operator/(tdualquat<T, P> const & q, T const & s); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> operator/(tdualquat<T, Q> const& q, T const& s); // -- Boolean operators -- - template <typename T, precision P> - GLM_FUNC_DECL bool operator==(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2); + template<typename T, qualifier Q> + GLM_FUNC_DECL bool operator==(tdualquat<T, Q> const& q1, tdualquat<T, Q> const& q2); + + template<typename T, qualifier Q> + GLM_FUNC_DECL bool operator!=(tdualquat<T, Q> const& q1, tdualquat<T, Q> const& q2); - template <typename T, precision P> - GLM_FUNC_DECL bool operator!=(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2); + /// Creates an identity dual quaternion. + /// + /// @see gtx_dual_quaternion + template <typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> dual_quat_identity(); /// Returns the normalized quaternion. /// /// @see gtx_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> normalize(tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> normalize(tdualquat<T, Q> const& q); /// Returns the linear interpolation of two dual quaternion. /// /// @see gtc_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> lerp(tdualquat<T, P> const & x, tdualquat<T, P> const & y, T const & a); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> lerp(tdualquat<T, Q> const& x, tdualquat<T, Q> const& y, T const& a); /// Returns the q inverse. /// /// @see gtx_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> inverse(tdualquat<T, P> const & q); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> inverse(tdualquat<T, Q> const& q); /// Converts a quaternion to a 2 * 4 matrix. /// /// @see gtx_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tmat2x4<T, P> mat2x4_cast(tdualquat<T, P> const & x); + template<typename T, qualifier Q> + GLM_FUNC_DECL mat<2, 4, T, Q> mat2x4_cast(tdualquat<T, Q> const& x); /// Converts a quaternion to a 3 * 4 matrix. /// /// @see gtx_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tmat3x4<T, P> mat3x4_cast(tdualquat<T, P> const & x); + template<typename T, qualifier Q> + GLM_FUNC_DECL mat<3, 4, T, Q> mat3x4_cast(tdualquat<T, Q> const& x); /// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion. /// /// @see gtx_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> dualquat_cast(tmat2x4<T, P> const & x); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> dualquat_cast(mat<2, 4, T, Q> const& x); /// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion. /// /// @see gtx_dual_quaternion - template <typename T, precision P> - GLM_FUNC_DECL tdualquat<T, P> dualquat_cast(tmat3x4<T, P> const & x); + template<typename T, qualifier Q> + GLM_FUNC_DECL tdualquat<T, Q> dualquat_cast(mat<3, 4, T, Q> const& x); - /// Dual-quaternion of low single-precision floating-point numbers. + /// Dual-quaternion of low single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<float, lowp> lowp_dualquat; - /// Dual-quaternion of medium single-precision floating-point numbers. + /// Dual-quaternion of medium single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<float, mediump> mediump_dualquat; - /// Dual-quaternion of high single-precision floating-point numbers. + /// Dual-quaternion of high single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<float, highp> highp_dualquat; - /// Dual-quaternion of low single-precision floating-point numbers. + /// Dual-quaternion of low single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<float, lowp> lowp_fdualquat; - /// Dual-quaternion of medium single-precision floating-point numbers. + /// Dual-quaternion of medium single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<float, mediump> mediump_fdualquat; - /// Dual-quaternion of high single-precision floating-point numbers. + /// Dual-quaternion of high single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<float, highp> highp_fdualquat; - /// Dual-quaternion of low double-precision floating-point numbers. + /// Dual-quaternion of low double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<double, lowp> lowp_ddualquat; - /// Dual-quaternion of medium double-precision floating-point numbers. + /// Dual-quaternion of medium double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<double, mediump> mediump_ddualquat; - /// Dual-quaternion of high double-precision floating-point numbers. + /// Dual-quaternion of high double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat<double, highp> highp_ddualquat; @@ -227,7 +235,7 @@ namespace glm /// @see gtx_dual_quaternion typedef highp_fdualquat dualquat; - /// Dual-quaternion of single-precision floating-point numbers. + /// Dual-quaternion of single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef highp_fdualquat fdualquat; @@ -246,7 +254,7 @@ namespace glm #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE)) - /// Dual-quaternion of default double-precision floating-point numbers. + /// Dual-quaternion of default double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef highp_ddualquat ddualquat; |