1#ifndef LIBSBX_MATH_QUATERNION_HPP_
2#define LIBSBX_MATH_QUATERNION_HPP_
9#include <yaml-cpp/yaml.h>
11#include <fmt/format.h>
13#include <libsbx/math/concepts.hpp>
14#include <libsbx/math/vector3.hpp>
15#include <libsbx/math/vector4.hpp>
16#include <libsbx/math/matrix4x4.hpp>
17#include <libsbx/math/angle.hpp>
21template<
floating_po
int Type>
24 template<
floating_po
int Other>
27 template<
floating_po
int Other>
30 template<
floating_po
int Other>
33 template<
floating_po
int Other>
38 using value_type = Type;
39 using reference = value_type&;
40 using const_reference =
const value_type&;
41 using size_type = std::size_t;
42 using length_type = std::float_t;
47 inline static constexpr basic_quaternion identity{vector_type::zero, value_type{1}};
49 template<
floating_po
int Other = value_type>
52 template<
floating_po
int Complex = value_type,
floating_po
int Scalar = value_type>
55 template<
floating_po
int Other = value_type>
58 template<
floating_po
int Other = value_type>
61 template<
floating_po
int Complex = value_type,
floating_po
int Scalar = value_type>
64 template<
floating_po
int Other = value_type>
67 [[nodiscard]]
constexpr operator matrix_type()
const noexcept;
69 [[nodiscard]]
constexpr auto to_matrix()
const noexcept ->
matrix_type;
71 template<
floating_po
int Other = value_type>
74 template<
floating_po
int Other = value_type>
77 template<
floating_po
int Other = value_type>
80 template<
floating_po
int Other = value_type>
83 template<
floating_po
int Other = value_type>
86 [[nodiscard]]
constexpr auto x()
noexcept -> reference;
88 [[nodiscard]]
constexpr auto x()
const noexcept -> const_reference;
90 [[nodiscard]]
constexpr auto y()
noexcept -> reference;
92 [[nodiscard]]
constexpr auto y()
const noexcept -> const_reference;
94 [[nodiscard]]
constexpr auto z()
noexcept -> reference;
96 [[nodiscard]]
constexpr auto z()
const noexcept -> const_reference;
98 [[nodiscard]]
constexpr auto w()
noexcept -> reference;
100 [[nodiscard]]
constexpr auto w()
const noexcept -> const_reference;
102 [[nodiscard]]
constexpr auto complex()
noexcept ->
vector_type&;
104 [[nodiscard]]
constexpr auto complex()
const noexcept ->
const vector_type&;
106 [[nodiscard]]
constexpr auto scalar()
noexcept -> reference;
108 [[nodiscard]]
constexpr auto scalar()
const noexcept -> const_reference;
110 [[nodiscard]]
constexpr auto length_squared()
const noexcept -> length_type;
112 [[nodiscard]]
constexpr auto length()
const noexcept -> length_type;
123template<
floating_po
int Lhs,
floating_po
int Rhs>
126template<
floating_po
int Lhs,
floating_po
int Rhs>
129template<
floating_po
int Lhs,
floating_po
int Rhs>
132template<
floating_po
int Type>
135template<
floating_po
int Lhs,
floating_po
int Rhs>
138template<
floating_po
int Lhs,
floating_po
int Rhs>
141template<
floating_po
int Lhs,
floating_po
int Rhs>
152template<sbx::math::
floating_po
int Type>
153struct std::hash<sbx::math::basic_quaternion<Type>> {
159template<sbx::math::
floating_po
int Type>
160struct YAML::convert<sbx::math::basic_quaternion<Type>> {
168template<sbx::math::
floating_po
int Type>
169struct fmt::formatter<sbx::math::basic_quaternion<Type>> {
171 template<
typename ParseContext>
172 constexpr auto parse(ParseContext& context) ->
decltype(context.begin());
174 template<
typename FormatContext>
179#include <libsbx/math/quaternion.ipp>
Definition: angle.hpp:251
Definition: matrix4x4.hpp:24
Definition: quaternion.hpp:22
Definition: vector3.hpp:22