25#ifndef LIBSBX_MATH_VECTOR_HPP_
26#define LIBSBX_MATH_VECTOR_HPP_
35#include <libsbx/utility/make_array.hpp>
36#include <libsbx/utility/assert.hpp>
37#include <libsbx/utility/zip.hpp>
41#include <libsbx/math/traits.hpp>
53template<std::
size_t Size, scalar Type>
57 template<std::
size_t S, scalar T>
63 using value_type = Type;
64 using reference = value_type&;
65 using const_reference =
const value_type&;
66 using size_type = std::size_t;
67 using length_type = std::float_t;
76 template<scalar Other = value_type>
86 template<scalar Other = value_type>
102 static constexpr auto min(
const basic_vector& vector)
noexcept -> value_type;
115 template<scalar Lhs = value_type, scalar Rhs = value_type>
125 static constexpr auto max(
const basic_vector& vector)
noexcept -> value_type;
138 template<scalar Lhs = value_type, scalar Rhs = value_type>
150 template<scalar Lhs = value_type>
163 template<
size_type Axis, scalar Other = value_type>
164 requires (Axis < Size)
183 constexpr auto data()
noexcept -> value_type*;
190 constexpr auto data()
const noexcept ->
const value_type*;
199 [[nodiscard]]
constexpr auto operator[](size_type index)
noexcept -> reference;
208 [[nodiscard]]
constexpr auto operator[](size_type index)
const noexcept -> const_reference;
219 template<scalar Other>
231 template<scalar Other>
243 template<scalar Other>
255 template<scalar Other>
267 template<scalar Other>
275 [[nodiscard]]
constexpr auto length_squared()
const noexcept -> length_type;
282 [[nodiscard]]
constexpr auto length()
const noexcept -> length_type;
293 template<std::convertible_to<value_type>... Args>
294 requires (
sizeof...(Args) == Size)
297 constexpr basic_vector(std::array<value_type, Size>&& components)
noexcept;
299 template<scalar Other>
300 [[nodiscard]]
static constexpr auto fill(Other value)
noexcept ->
basic_vector;
302 template<std::
size_t Index, scalar Other>
303 [[nodiscard]]
static constexpr auto axis(Other value)
noexcept ->
basic_vector;
307 std::array<Type, Size> _components;
323template<std::
size_t Size, scalar Lhs, scalar Rhs>
338template<std::
size_t Size, scalar Lhs, scalar Rhs>
353template<std::
size_t Size, scalar Lhs, scalar Rhs>
368template<std::
size_t Size, scalar Lhs, scalar Rhs>
383template<std::
size_t Size, scalar Lhs, scalar Rhs>
388#include <libsbx/math/vector.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
Fixed-size vector type.
Definition: vector.hpp:55
Concept for scalar numeric types.
Definition: concepts.hpp:150
Generic math algorithms and helpers.
constexpr auto abs(const Type value) -> Type
Computes the absolute value.
Definition: algorithm.ipp:12
Core numeric concepts and type traits.