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); });
297 template <
typename T>
321 std::fill_n(data, 2, val);
339 std::copy_n(array, 2, data);
529 template <
typename T>
553 std::fill_n(data, 3, val);
571 std::copy_n(array, 3, data);
594 : data{ xy.x, xy.y, z }
767 template <
typename T>
791 std::fill_n(data, 4, val);
809 std::copy_n(array, 4, data);
1140 extern template struct Vector<
float, 2>;
1141 extern template struct Vector<
float, 3>;
1142 extern template struct Vector<
float, 4>;
1144 extern template struct Vector<
double, 2>;
1145 extern template struct Vector<
double, 3>;
1146 extern template struct Vector<
double, 4>;
1148 extern template struct Vector<
int, 2>;
1149 extern template struct Vector<
int, 3>;
1150 extern template struct Vector<
int, 4>;
1152 extern template struct Vector<
unsigned, 2>;
1153 extern template struct Vector<
unsigned, 3>;
1154 extern template struct Vector<
unsigned, 4>;
1156 extern template struct Vector<
bool, 2>;
1157 extern template struct Vector<
bool, 3>;
1158 extern template struct Vector<
bool, 4>;
1160 extern template struct Vector<uint8_t, 3>;
1161 extern template struct Vector<uint8_t, 4>;
1181 template<
typename T, std::size_t N>
1182 using Distance = T (*)(Vector<T, N>, Vector<T, N>);
1190 template<
typename T>
1191 using Distance2 = Distance<T, 2>;
1199 template<
typename T>
1200 using Distance3 = Distance<T, 3>;
1202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:569
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:552
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:650
T * end()
Iterator to the element after the last one.
Definition: Vector.h:203
const T * cbegin() const
Iterator.on the first element (const version).
Definition: Vector.h:925
const T * cbegin() const
Iterator.on the first element (const version).
Definition: Vector.h:697
constexpr Vector(T x, T y)
Constructor that takes 2 components.
Definition: Vector.h:348
friend class RenderTarget
Definition: Shader.h:388
T * begin()
Iterator.to the first element.
Definition: Vector.h:194
T * begin()
Iterator.to the first element.
Definition: Vector.h:660
const T * cend() const
Iterator on the element after the last one (const version).
Definition: Vector.h:460
Vector()=default
Default constructor.
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:878
const T * begin() const
Iterator.to the first element (const version).
Definition: Vector.h:678
constexpr Vector(T x, T y, T z)
Constructor that takes 3 components.
Definition: Vector.h:581
T data[N]
The internal representation of the vector.
Definition: Vector.h:251
const T * cend() const
Iterator on the element after the last one (const version).
Definition: Vector.h:707
T * end()
Iterator to the element after the last one.
Definition: Vector.h:669
const T * end() const
Iterator on the element after the last one (const version).
Definition: Vector.h:688
constexpr Vector(T x, T y, T z, T w)
Constructor that takes 4 components.
Definition: Vector.h:820
const T * cbegin() const
Iterator.on the first element (const version).
Definition: Vector.h:450
const T * cend() const
Iterator on the element after the last one (const version).
Definition: Vector.h:240
The namespace for gf classes.
Definition: Action.h:34
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:184
Vector & operator=(const Vector &other)=default
Default copy assignment.
Vector(const Vector &other)=default
Default copy constructor.
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:635
const T * begin() const
Iterator.to the first element (const version).
Definition: Vector.h:212
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:863
Vector()=default
Default constructor.
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:389
T & operator[](std::size_t i)
Access to the -th coordinate.
Definition: Vector.h:404
const T * end() const
Iterator on the element after the last one (const version).
Definition: Vector.h:916
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:807
const T * end() const
Iterator on the element after the last one (const version).
Definition: Vector.h:222
T * end()
Iterator to the element after the last one.
Definition: Vector.h:897
constexpr Vector(Vector< T, 2 > xy, T z)
Constructor that takes a 2D vector and a z component.
Definition: Vector.h:593
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:337
Vector(const Vector &other)=default
Default copy constructor.
Vector(const Vector< U, 3 > &other)
Converting copy constructor.
Definition: Vector.h:616
Vector()=default
Default constructor.
const T * begin() const
Iterator.to the first element (const version).
Definition: Vector.h:906
Vector(const Vector &other)=default
Default copy constructor.
const T * cbegin() const
Iterator.on the first element (const version).
Definition: Vector.h:230
const T * cend() const
Iterator on the element after the last one (const version).
Definition: Vector.h:935
Vector(const Vector< U, 4 > &other)
Converting copy constructor.
Definition: Vector.h:843
T operator[](std::size_t i) const
Access to the -th coordinate.
Definition: Vector.h:169
Vector(const Vector< U, N > &other)
Converting copy constructor.
Definition: Vector.h:144
Vector(const Vector &other)=default
Default copy constructor.
const T * begin() const
Iterator.to the first element (const version).
Definition: Vector.h:432
T * begin()
Iterator.to the first element.
Definition: Vector.h:414
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
const T * end() const
Iterator on the element after the last one (const version).
Definition: Vector.h:442
Vector(const Vector< U, 2 > &other)
Converting copy constructor.
Definition: Vector.h:371
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:320
T * begin()
Iterator.to the first element.
Definition: Vector.h:888
Vector()=default
Default constructor.
Vector(T *array)
Constructor that takes an array.
Definition: Vector.h:104
T * end()
Iterator to the element after the last one.
Definition: Vector.h:423
Vector(T val)
Constructor that fills the vector with a value.
Definition: Vector.h:790