Basic N-dimensional vector implementation template.
More...
#include <eagine/math/vector.hpp>
|
constexpr auto | operator[] (int pos) const noexcept |
| Subscript operator.
|
|
template<int M = N> |
constexpr auto | x () const noexcept -> std::enable_if_t<(M > 0), T > |
| Returns the x-coordinate value. More...
|
|
template<int M = N> |
constexpr auto | y () const noexcept -> std::enable_if_t<(M > 1), T > |
| Returns the y-coordinate value. More...
|
|
template<int M = N> |
constexpr auto | z () const noexcept -> std::enable_if_t<(M > 2), T > |
| Returns the z-coordinate value. More...
|
|
template<int M = N> |
constexpr auto | w () const noexcept -> std::enable_if_t<(M > 3), T > |
| Returns the w-coordinate value. More...
|
|
auto | operator+= (vector_param a) noexcept -> auto & |
| Addition operator.
|
|
auto | operator-= (vector_param a) noexcept -> auto & |
| Subtraction operator.
|
|
auto | operator*= (vector_param a) noexcept -> auto & |
| Multiplication operator.
|
|
auto | operator*= (scalar_param c) noexcept -> auto & |
| Multiplication by scalar operator.
|
|
auto | operator*= (T c) noexcept -> auto & |
| Multiplication by constant operator.
|
|
|
static auto | zero () noexcept |
| Creates a new zero vector instance.
|
|
static auto | fill (T v) noexcept |
| Creates a zero vector instance with all elements set to v .
|
|
template<int I> |
static auto | axis () noexcept |
| Creates an unit axis vector for the I-th dimension. More...
|
|
template<int I> |
static auto | axis (T v) noexcept |
| Creates an axis vector for the I-th dimension with specified length. More...
|
|
static auto | axis (int i, T v) noexcept |
| Creates an axis vector for the i-th dimension with specified length. More...
|
|
template<typename... P, typename = std::enable_if_t<(N > 1) && (sizeof...(P) == N)>> |
static constexpr auto | make (P &&... p) noexcept |
| Creates vector instance with the specified elements.
|
|
template<typename P , int M, bool W, typename = std::enable_if_t<(!std::is_same_v<T, P> || (N != M) || (V != W))>> |
static constexpr auto | from (const vector< P, M, W > &v, T d=T(0)) noexcept |
| Creates vector instance from vector of another dimension. More...
|
|
template<typename P , int M, bool W> |
static constexpr auto | from (const vector< P, M, W > &v, const vector< T, N - M, W > &u) noexcept |
| Creates vector instance from two other vectors.
|
|
static auto | from (const T *dt, span_size_t sz) noexcept |
| Creates vector instance from data pointer and length.
|
|
static auto | from (const T *dt, span_size_t sz, T fv) noexcept |
| Creates vector instance from data pointer, length and additional value.
|
|
|
constexpr friend auto | operator+ (vector_param a) noexcept |
| Unary plus operator.
|
|
constexpr friend auto | operator- (vector_param a) noexcept |
| Negation operator.
|
|
constexpr friend auto | operator+ (vector_param a, vector_param b) noexcept |
| Addition operator.
|
|
constexpr friend auto | operator- (vector_param a, vector_param b) noexcept |
| Subtraction operator.
|
|
constexpr friend auto | operator* (vector_param a, vector_param b) noexcept |
| Multiplication operator.
|
|
constexpr friend auto | operator* (scalar_param c, vector_param a) noexcept |
| Multiplication by scalar operator.
|
|
constexpr friend auto | operator* (vector_param a, scalar_param c) noexcept |
| Multiplication by scalar operator.
|
|
constexpr friend auto | operator* (T c, vector_param a) noexcept |
| Multiplication by constant operator.
|
|
constexpr friend auto | operator* (vector_param a, T c) noexcept |
| Multiplication by constant operator.
|
|
constexpr friend auto | operator/ (vector_param a, vector_param b) noexcept |
| Division operator.
|
|
constexpr friend auto | operator/ (scalar_param c, vector_param a) noexcept |
| Scalar division operator.
|
|
constexpr friend auto | operator/ (vector_param a, scalar_param c) noexcept |
| Division by scalar operator.
|
|
constexpr friend auto | operator/ (vector_param a, T c) noexcept |
| Division by constant operator.
|
|
constexpr friend auto | operator/ (T c, vector_param a) noexcept |
| Constant division operator.
|
|
template<typename T, int N, bool V>
struct eagine::math::vector< T, N, V >
Basic N-dimensional vector implementation template.
- See also
- tvec
- Note
- This is a base class, typically tvec should be used in client code.
◆ axis() [1/3]
template<typename T , int N, bool V>
template<int I>
Creates an unit axis vector for the I-th dimension.
- Precondition
- I < N
◆ axis() [2/3]
template<typename T , int N, bool V>
Creates an axis vector for the i-th dimension with specified length.
- Precondition
- i < N
◆ axis() [3/3]
template<typename T , int N, bool V>
template<int I>
Creates an axis vector for the I-th dimension with specified length.
- Precondition
- I < N
◆ from()
template<typename T , int N, bool V>
template<typename P , int M, bool W, typename = std::enable_if_t<(!std::is_same_v<T, P> || (N != M) || (V != W))>>
|
inlinestaticconstexprnoexcept |
◆ w()
template<typename T , int N, bool V>
template<int M = N>
Returns the w-coordinate value.
- Precondition
- N >= 4
◆ x()
template<typename T , int N, bool V>
template<int M = N>
Returns the x-coordinate value.
- Precondition
- N >= 1
◆ y()
template<typename T , int N, bool V>
template<int M = N>
Returns the y-coordinate value.
- Precondition
- N >= 2
◆ z()
template<typename T , int N, bool V>
template<int M = N>
Returns the z-coordinate value.
- Precondition
- N >= 3
The documentation for this struct was generated from the following files: