vector.h file
Contains the definition of muu::
Namespaces
- namespace muu
- The root namespace for all muu functions and types.
Classes
-
template <typename Scalar, size_t Dimensions>struct muu::vector
- An N-dimensional vector.
-
template <typename Scalar, size_struct std::tuple_size<muu::vector<Scalar, Dimensions>>
t Dimensions> - Specialization of std::tuple_size for muu::
vector. - struct std::tuple_element<I, muu::vector<Scalar, Dimensions>>
- Specialization of std::tuple_element for muu::
vector. -
template <typename Scalar, size_t Dimensions>struct muu::constants<vector<Scalar, Dimensions>>
- Vector constants.
Functions
-
template <typename S, size_t D>auto abs(const vector<S, D>& v) -> vector<S, D> constexpr noexcept
- Returns a copy of a vector with all scalar components set to their absolute values.
-
template <typename S, size_t D>auto angle(const vector<S, D>& v1, const vector<S, D>& v2) -> delta_scalar_type constexpr noexcept
- Calculates the angle between two vectors.
-
template <typename S, typename T, size_t D>auto approx_equal(const vector<S, D>& v1, const vector<T, D>& v2, epsilon_type<S, T> epsilon = default_epsilon<S, T>) -> bool constexpr noexcept
- Returns true if two vectors are approximately equal.
-
template <typename S, size_t D>auto approx_zero(const vector<S, D>& v, S epsilon = default_epsilon<S>) -> bool constexpr noexcept
- Returns true if all the scalar components of a vector are approximately equal to zero.
-
template <typename S, size_t D>auto ceil(const vector<S, D>& v) -> vector<S, D> constexpr noexcept
- Returns a copy of a vector with all scalar components set to the lowest integer not less than their original values.
-
template <typename S, size_t D>auto clamp(const vector<S, D>& v, const vector<S, D>& low, const vector<S, D>& high) -> vector<S, D> constexpr noexcept
- Componentwise clamps a vector between two others.
-
template <typename S, size_t D>auto consteval_distance(const vector<S, D>& p1, const vector<S, D>& p2) -> delta_scalar_type consteval noexcept
- Returns the distance between two points.
-
template <typename S, size_t D>auto consteval_length(const vector<S, D>& v) -> delta_scalar_type consteval noexcept
- Returns the length (magnitude) of a vector.
-
template <typename S, size_t D>auto consteval_normalize(const vector<S, D>& v) -> vector<S, D> consteval noexcept
- Normalizes a vector.
-
template <typename S>auto cross(const vector<S, 3>& lhs, const vector<S, 3>& rhs) -> product_type constexpr noexcept
- Returns the cross product of two three-dimensional vectors.
-
template <typename S, size_t D>auto direction(const vector<S, D>& from, const vector<S, D>& to, delta_scalar_type& distance_out) -> delta_type constexpr noexcept
- Returns the normalized direction vector from one position to another.
-
template <typename S, size_t D>auto direction(const vector<S, D>& from, const vector<S, D>& to) -> delta_type constexpr noexcept
- Returns the normalized direction vector from one position to another.
-
template <typename S, size_t D>auto distance(const vector<S, D>& p1, const vector<S, D>& p2) -> delta_scalar_type constexpr noexcept
- Returns the distance between two points.
-
template <typename S, size_t D>auto distance_squared(const vector<S, D>& p1, const vector<S, D>& p2) -> delta_scalar_type constexpr noexcept
- Returns the squared distance between two points.
-
template <typename S, size_t D>auto dot(const vector<S, D>& v1, const vector<S, D>& v2) -> product_scalar_type constexpr noexcept
- Returns the dot product of two vectors.
-
template <typename S, size_t D>auto floor(const vector<S, D>& v) -> vector<S, D> constexpr noexcept
- Returns a copy of a vector with all scalar components set to the highest integer not greater than their original values.
-
template <typename S, size_t D>auto infinity_or_nan(const vector<S, D>& v) -> bool constexpr noexcept
- Returns true if any of the scalar components of a vector are infinity or NaN.
-
template <typename S, size_t D>auto length(const vector<S, D>& v) -> delta_scalar_type constexpr noexcept
- Returns the length (magnitude) of a vector.
-
template <typename S, size_t D>auto length_squared(const vector<S, D>& v) -> delta_scalar_type constexpr noexcept
- Returns the squared length of a vector.
-
template <typename S, size_t D>auto lerp(const vector<S, D>& start, const vector<S, D>& finish, delta_scalar_type alpha) -> vector<S, D> constexpr noexcept
- Performs a linear interpolation between two vectors.
-
template <typename S, size_t D, typename... T>auto max(const vector<S, D>& v1, const vector<S, D>& v2, const T&... vecs) -> vector<S, D> constexpr noexcept
- Returns the componentwise maximum of two or more vectors.
-
template <typename S, size_t D, typename... T>auto min(const vector<S, D>& v1, const vector<S, D>& v2, const T&... vecs) -> vector<S, D> constexpr noexcept
- Returns the componentwise minimum of two or more vectors.
-
template <typename S, size_t D>auto normalize(const vector<S, D>& v, delta_scalar_type& length_out) -> vector<S, D> constexpr noexcept
- Normalizes a vector.
-
template <typename S, size_t D>auto normalize(const vector<S, D>& v) -> vector<S, D> constexpr noexcept
- Normalizes a vector.
-
template <typename S, size_t D>auto normalized(const vector<S, D>& v) -> bool constexpr noexcept
- Returns true if a vector is normalized (i.e. has a length of 1).