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;
50 template<scalar Other>
53 template<scalar Other>
66 [[nodiscard]]
constexpr auto x()
noexcept -> reference;
68 [[nodiscard]]
constexpr auto x()
const noexcept -> const_reference;
70 [[nodiscard]]
constexpr auto y()
noexcept -> reference;
72 [[nodiscard]]
constexpr auto y()
const noexcept -> const_reference;
76template<scalar Lhs, scalar Rhs>
79template<scalar Lhs, scalar Rhs>
85template<scalar Lhs, scalar Rhs>
88template<scalar Lhs, scalar Rhs>
91template<scalar Lhs, scalar Rhs>
94template<scalar Lhs, scalar Rhs>
107template<sbx::math::scalar Type>
108struct std::hash<sbx::math::basic_vector2<Type>> {
114template<sbx::math::scalar Type>
115struct YAML::convert<sbx::math::basic_vector2<Type>> {
123template<sbx::math::scalar Type>
124struct fmt::formatter<sbx::math::basic_vector2<Type>> {
126 template<
typename ParseContext>
127 constexpr auto parse(ParseContext& context) ->
decltype(context.begin());
129 template<
typename FormatContext>
134#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.