1#ifndef LIBSBX_MATH_MATRIX3X3_HPP_
2#define LIBSBX_MATH_MATRIX3X3_HPP_
13#include <fmt/format.h>
15#include <libsbx/math/concepts.hpp>
16#include <libsbx/math/fwd.hpp>
17#include <libsbx/math/vector3.hpp>
18#include <libsbx/math/vector4.hpp>
19#include <libsbx/math/matrix.hpp>
20#include <libsbx/math/angle.hpp>
29 template<scalar Other>
32 inline static constexpr auto x_axis = std::size_t{0u};
33 inline static constexpr auto y_axis = std::size_t{1u};
34 inline static constexpr auto z_axis = std::size_t{2u};
38 using value_type = base_type::value_type;
39 using reference = base_type::reference;
40 using const_reference = base_type::const_reference;
41 using size_type = base_type::size_type;
44 inline static constexpr basic_matrix3x3 identity{base_type::identity()};
48 using base_type::base_type;
52 template<
typename Column>
59 template<scalar Other>
61 Other x0, Other x1, Other x2,
62 Other y0, Other y1, Other y2,
63 Other z0, Other z1, Other z2
66 template<scalar Other>
67 constexpr basic_matrix3x3(
const Other v00,
const Other v11,
const Other v22)
noexcept;
74 result[0][0] = matrix[0][0];
75 result[0][1] = matrix[1][0];
76 result[0][2] = matrix[2][0];
78 result[1][0] = matrix[0][1];
79 result[1][1] = matrix[1][1];
80 result[1][2] = matrix[2][1];
82 result[2][0] = matrix[0][2];
83 result[2][1] = matrix[1][2];
84 result[2][2] = matrix[2][2];
91 column_type::abs(matrix[0]),
92 column_type::abs(matrix[1]),
93 column_type::abs(matrix[2])
109 constexpr auto operator[](size_type index)
const noexcept ->
const column_type&;
111 constexpr auto operator[](size_type index)
noexcept ->
column_type&;
124template<scalar Lhs, scalar Rhs>
127template<scalar Lhs, scalar Rhs>
146template<sbx::math::scalar Type>
147struct fmt::formatter<sbx::math::basic_matrix3x3<Type>> {
149 template<
typename ParseContext>
150 constexpr auto parse(ParseContext& context) ->
decltype(context.begin()) {
151 return context.begin();
154 template<
typename FormatContext>
156 if constexpr (sbx::math::is_floating_point_v<Type>) {
157 return fmt::format_to(context.out(),
158 "\n{:.2f}, {:.2f}, {:.2f}\n{:.2f}, {:.2f}, {:.2f}\n{:.2f}, {:.2f}, {:.2f}\n{:.2f}, {:.2f}, {:.2f}",
159 matrix[0][0], matrix[1][0], matrix[2][0],
160 matrix[0][1], matrix[1][1], matrix[2][1],
161 matrix[0][2], matrix[1][2], matrix[2][2]
164 return fmt::format_to(context.out(),
165 "\n{}, {}, {}\n{}, {}, {}\n{}, {}, {}\n{}, {}, {}",
166 matrix[0][0], matrix[1][0], matrix[2][0],
167 matrix[0][1], matrix[1][1], matrix[2][1],
168 matrix[0][2], matrix[1][2], matrix[2][2]
175#include <libsbx/math/matrix3x3.ipp>
Definition: matrix3x3.hpp:25
Definition: matrix.hpp:13
Definition: vector3.hpp:22