28 #include <initializer_list>
29 #include <type_traits>
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 template<
typename T, std::size_t N>
61 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 static_assert(
N > 0,
"N must be strictly positive");
88 std::fill_n(
data, N, val);
106 std::copy_n(array, N,
data);
124 std::copy_n(list.begin(), std::min(list.size(), N),
data);
147 std::transform(
data,
data + N, other.data, [](U val) {
return static_cast<T>(val); });
226 T
const *
end(
void)
const {
303 template <
typename T>
327 std::fill_n(data, 2, val);
345 std::copy_n(array, 2, data);
452 T
const *
end(
void)
const {
541 template <
typename T>
565 std::fill_n(data, 3, val);
583 std::copy_n(array, 3, data);
606 : data{ xy.x, xy.y, z }
704 T
const *
end(
void)
const {
784 template <
typename T>
808 std::fill_n(data, 4, val);
826 std::copy_n(array, 4, data);
937 T
const *
end(
void)
const {
1118 extern template struct Vector<
float, 2>;
1119 extern template struct Vector<
float, 3>;
1120 extern template struct Vector<
float, 4>;
1122 extern template struct Vector<
double, 2>;
1123 extern template struct Vector<
double, 3>;
1124 extern template struct Vector<
double, 4>;
1126 extern template struct Vector<
int, 2>;
1127 extern template struct Vector<
int, 3>;
1128 extern template struct Vector<
int, 4>;
1130 extern template struct Vector<
unsigned, 2>;
1131 extern template struct Vector<
unsigned, 3>;
1132 extern template struct Vector<
unsigned, 4>;
1134 extern template struct Vector<
bool, 2>;
1135 extern template struct Vector<
bool, 3>;
1136 extern template struct Vector<
bool, 4>;
1138 extern template struct Vector<uint8_t, 3>;
1139 extern template struct Vector<uint8_t, 4>;
1159 template<
typename T, std::size_t N>
1160 using Distance = T (*)(
const Vector<T, N>&,
const Vector<T, N>&);
1168 template<
typename T>
1169 using Distance2 = Distance<T, 2>;
1177 template<
typename T>
1178 using Distance3 = Distance<T, 3>;
1180 #ifndef DOXYGEN_SHOULD_SKIP_THIS
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:581
T const * end(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:226
T const * cbegin(void) const
Iterator.on the first element (const version).
Definition: Vector.h:946
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:564
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:662
T const * cend(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:724
T * begin(void)
Iterator.to the first element.
Definition: Vector.h:906
T const * cend(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:957
constexpr Vector(T x, T y)
Constructor that takes 2 components.
Definition: Vector.h:354
friend class RenderTarget
Definition: Shader.h:387
T const * end(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:452
T const * end(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:937
Vector()=default
Default constructor.
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:895
T const * begin(void) const
Iterator.to the first element (const version).
Definition: Vector.h:215
constexpr Vector(T x, T y, T z)
Constructor that takes 3 components.
Definition: Vector.h:593
T const * cbegin(void) const
Iterator.on the first element (const version).
Definition: Vector.h:713
T data[N]
The internal representation of the vector.
Definition: Vector.h:257
T const * begin(void) const
Iterator.to the first element (const version).
Definition: Vector.h:693
constexpr Vector(T x, T y, T z, T w)
Constructor that takes 4 components.
Definition: Vector.h:837
T const * cbegin(void) const
Iterator.on the first element (const version).
Definition: Vector.h:461
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:184
T const * cend(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:246
Vector & operator=(const Vector &other)=default
Default copy assignment.
T * begin(void)
Iterator.to the first element.
Definition: Vector.h:195
Vector(const Vector &other)=default
Default copy constructor.
T const * end(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:704
T const * begin(void) const
Iterator.to the first element (const version).
Definition: Vector.h:926
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:647
T * end(void)
Iterator to the element after the last one.
Definition: Vector.h:431
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:880
T * end(void)
Iterator to the element after the last one.
Definition: Vector.h:916
Vector()=default
Default constructor.
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:395
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:410
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:824
constexpr Vector(Vector< T, 2 > xy, T z)
Constructor that takes a 2D vector and a z component.
Definition: Vector.h:605
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:343
Vector(const Vector &other)=default
Default copy constructor.
Vector(const Vector< U, 3 > &other)
Converting copy constructor.
Definition: Vector.h:628
Vector()=default
Default constructor.
T const * cend(void) const
Iterator on the element after the last one (const version).
Definition: Vector.h:472
Vector(const Vector &other)=default
Default copy constructor.
T const * begin(void) const
Iterator.to the first element (const version).
Definition: Vector.h:441
Vector(const Vector< U, 4 > &other)
Converting copy constructor.
Definition: Vector.h:860
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:169
T const * cbegin(void) const
Iterator.on the first element (const version).
Definition: Vector.h:235
Vector(const Vector< U, N > &other)
Converting copy constructor.
Definition: Vector.h:144
Vector(const Vector &other)=default
Default copy constructor.
T * begin(void)
Iterator.to the first element.
Definition: Vector.h:673
General purpose math vector.
Definition: Vector.h:60
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:86
Vector(std::initializer_list< T > list)
Constructor that takes an initializer list.
Definition: Vector.h:122
Vector(const Vector< U, 2 > &other)
Converting copy constructor.
Definition: Vector.h:377
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:326
T * end(void)
Iterator to the element after the last one.
Definition: Vector.h:205
T * begin(void)
Iterator.to the first element.
Definition: Vector.h:421
Vector()=default
Default constructor.
T * end(void)
Iterator to the element after the last one.
Definition: Vector.h:683
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:104
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:807