1#ifndef LIBSBX_MATH_VECTOR3_HPP_
2#define LIBSBX_MATH_VECTOR3_HPP_
11#include <yaml-cpp/yaml.h>
13#include <fmt/format.h>
15#include <libsbx/math/concepts.hpp>
16#include <libsbx/math/vector.hpp>
17#include <libsbx/math/vector2.hpp>
26 inline static constexpr auto x_axis = std::size_t{0u};
27 inline static constexpr auto y_axis = std::size_t{1u};
28 inline static constexpr auto z_axis = std::size_t{2u};
32 using value_type = base_type::value_type;
33 using reference = base_type::reference;
34 using const_reference = base_type::const_reference;
35 using size_type = base_type::size_type;
36 using length_type = base_type::length_type;
38 inline static constexpr basic_vector3 zero{base_type::fill(value_type{0})};
39 inline static constexpr basic_vector3 one{base_type::fill(value_type{1})};
40 inline static constexpr basic_vector3 right{base_type::template axis<x_axis>(value_type{1})};
41 inline static constexpr basic_vector3 left{base_type::template axis<x_axis>(value_type{-1})};
42 inline static constexpr basic_vector3 up{base_type::template axis<y_axis>(value_type{1})};
43 inline static constexpr basic_vector3 down{base_type::template axis<y_axis>(value_type{-1})};
44 inline static constexpr basic_vector3 forward{base_type::template axis<z_axis>(value_type{-1})};
45 inline static constexpr basic_vector3 backward{base_type::template axis<z_axis>(value_type{1})};
47 using base_type::base_type;
51 template<scalar X, scalar Y, scalar Z>
54 template<scalar Other, scalar Scalar = Other>
69 [[nodiscard]]
constexpr auto x()
noexcept -> reference;
71 [[nodiscard]]
constexpr auto x()
const noexcept -> const_reference;
73 [[nodiscard]]
constexpr auto y()
noexcept -> reference;
75 [[nodiscard]]
constexpr auto y()
const noexcept -> const_reference;
77 [[nodiscard]]
constexpr auto z()
noexcept -> reference;
79 [[nodiscard]]
constexpr auto z()
const noexcept -> const_reference;
85template<scalar Lhs, scalar Rhs>
88template<scalar Lhs, scalar Rhs>
94template<scalar Lhs, scalar Rhs>
97template<scalar Lhs, std::convertible_to<Lhs> Rhs>
98requires (!is_scalar_v<Rhs>)
101template<scalar Lhs, scalar Rhs>
104template<scalar Lhs, std::convertible_to<Lhs> Rhs>
105requires (!is_scalar_v<Rhs>)
118template<sbx::math::scalar Type>
119struct std::hash<sbx::math::basic_vector3<Type>> {
125template<sbx::math::scalar Type>
126struct fmt::formatter<sbx::math::basic_vector3<Type>> {
128 template<
typename ParseContext>
129 constexpr auto parse(ParseContext& context)
noexcept ->
decltype(context.begin());
131 template<
typename FormatContext>
136template<sbx::math::scalar Type>
137struct YAML::convert<sbx::math::basic_vector3<Type>> {
145#include <libsbx/math/vector3.ipp>
A vector in two-dimensional space.
Definition: vector2.hpp:27
Definition: vector3.hpp:22
Definition: vector.hpp:19