2#ifndef LIBSBX_MATH_VECTOR4_HPP_
3#define LIBSBX_MATH_VECTOR4_HPP_
13#include <fmt/format.h>
15#include <yaml-cpp/yaml.h>
18#include <libsbx/math/vector2.hpp>
19#include <libsbx/math/vector3.hpp>
28 inline static constexpr auto x_axis = std::size_t{0u};
29 inline static constexpr auto y_axis = std::size_t{1u};
30 inline static constexpr auto z_axis = std::size_t{2u};
31 inline static constexpr auto w_axis = std::size_t{3u};
35 using value_type = base_type::value_type;
36 using reference = base_type::reference;
37 using const_reference = base_type::const_reference;
38 using size_type = base_type::size_type;
39 using length_type = base_type::length_type;
41 inline static constexpr basic_vector4 zero{base_type::fill(value_type{0})};
42 inline static constexpr basic_vector4 one{base_type::fill(value_type{1})};
44 using base_type::base_type;
48 template<scalar XOther, scalar YOther, scalar ZOther, scalar WOther>
49 constexpr basic_vector4(XOther x, YOther y, ZOther z, WOther w)
noexcept;
51 template<scalar Other, scalar ScalarW = Other>
54 template<scalar Other, scalar ScalarZ = Other, scalar ScalarW = Other>
63 [[nodiscard]]
constexpr auto x()
noexcept -> reference;
65 [[nodiscard]]
constexpr auto x()
const noexcept -> const_reference;
67 [[nodiscard]]
constexpr auto y()
noexcept -> reference;
69 [[nodiscard]]
constexpr auto y()
const noexcept -> const_reference;
71 [[nodiscard]]
constexpr auto z()
noexcept -> reference;
73 [[nodiscard]]
constexpr auto z()
const noexcept -> const_reference;
75 [[nodiscard]]
constexpr auto w()
noexcept -> reference;
77 [[nodiscard]]
constexpr auto w()
const noexcept -> const_reference;
81template<scalar Lhs, scalar Rhs>
84template<scalar Lhs, scalar Rhs>
90template<scalar Lhs, scalar Rhs>
93template<scalar Lhs, scalar Rhs>
96template<scalar Lhs, scalar Rhs>
109template<sbx::math::scalar Type>
110struct std::hash<sbx::math::basic_vector4<Type>> {
116template<sbx::math::scalar Type>
117struct fmt::formatter<sbx::math::basic_vector4<Type>> {
119 template<
typename ParseContext>
120 constexpr auto parse(ParseContext& context)
noexcept ->
decltype(context.begin());
122 template<
typename FormatContext>
127template<sbx::math::scalar Type>
128struct YAML::convert<sbx::math::basic_vector4<Type>> {
136#include <libsbx/math/vector4.ipp>
constexpr auto operator/(basic_degree< Type > lhs, const Other rhs) noexcept -> basic_degree< Type >
Divides a degree value by a scalar factor.
Definition: angle.ipp:112
constexpr auto operator+(basic_degree< Type > lhs, const basic_degree< Other > &rhs) noexcept -> basic_degree< Type >
Adds two degree values.
Definition: angle.ipp:90
constexpr auto operator*(basic_degree< Type > lhs, const Other rhs) noexcept -> basic_degree< Type >
Multiplies a degree value by a scalar factor.
Definition: angle.ipp:105
A vector in two-dimensional space.
Definition: vector2.hpp:28
Definition: vector3.hpp:23
Definition: vector4.hpp:24
Fixed-size vector type.
Definition: vector.hpp:55
Concept for scalar numeric types.
Definition: concepts.hpp:150
Core numeric concepts and type traits.