2#ifndef LIBSBX_MATH_VECTOR2_HPP_
3#define LIBSBX_MATH_VECTOR2_HPP_
13#include <yaml-cpp/yaml.h>
15#include <fmt/format.h>
32 inline static constexpr auto x_axis = std::size_t{0u};
33 inline static constexpr auto y_axis = std::size_t{1u};
37 using value_type = base_type::value_type;
38 using reference = base_type::reference;
39 using const_reference = base_type::const_reference;
40 using size_type = base_type::size_type;
41 using length_type = base_type::length_type;
43 inline static constexpr basic_vector2 zero{base_type::fill(value_type{0})};
44 inline static constexpr basic_vector2 one{base_type::fill(value_type{1})};
46 using base_type::base_type;
52 template<scalar Other>
55 template<scalar Other>
68 [[nodiscard]]
constexpr auto x()
noexcept -> reference;
70 [[nodiscard]]
constexpr auto x()
const noexcept -> const_reference;
72 [[nodiscard]]
constexpr auto y()
noexcept -> reference;
74 [[nodiscard]]
constexpr auto y()
const noexcept -> const_reference;
78template<scalar Lhs, scalar Rhs>
81template<scalar Lhs, scalar Rhs>
87template<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_vector2<Type>> {
116template<sbx::math::scalar Type>
117struct YAML::convert<sbx::math::basic_vector2<Type>> {
125template<sbx::math::scalar Type>
126struct fmt::formatter<sbx::math::basic_vector2<Type>> {
128 template<
typename ParseContext>
129 constexpr auto parse(ParseContext& context) ->
decltype(context.begin());
131 template<
typename FormatContext>
136template<sbx::math::scalar Type>
138 return out << YAML::convert<sbx::math::basic_vector2<Type>>::encode(vector);
141#include <libsbx/math/vector2.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
Fixed-size vector type.
Definition: vector.hpp:55
Concept for scalar numeric types.
Definition: concepts.hpp:150
Core numeric concepts and type traits.
Generic fixed-size vector type.