25void to_csv(
const std::vector<glm::vec3> &xyz,
const std::string &fname);
29template <
typename T>
struct Vec2;
32struct [[deprecated(
"Replaced by glm::vec2")]]
Vec2<float> :
public glm::vec2
34 using glm::vec2::vec2;
40struct [[deprecated(
"Replaced by glm::ivec2")]]
Vec2<int> :
public glm::ivec2
42 using glm::ivec2::ivec2;
47template <
typename T>
struct Vec3;
50struct [[deprecated(
"Replaced by glm::vec3")]]
Vec3<float> :
public glm::vec3
52 using glm::vec3::vec3;
59struct [[deprecated(
"Replaced by glm::ivec3")]]
Vec3<int> :
public glm::ivec3
61 using glm::ivec3::ivec3;
67template <
typename T>
struct Vec4;
70struct [[deprecated(
"Replaced by glm::vec4")]]
Vec4<float> :
public glm::vec4
72 using glm::vec4::vec4;
86 const float &a_const = x;
87 const float &b_const = y;
88 const float &c_const = z;
89 const float &d_const = w;
93struct [[deprecated(
"Replaced by glm::ivec4")]]
Vec4<int> :
public glm::ivec4
95 using glm::ivec4::ivec4;
109 const int &a_const = x;
110 const int &b_const = y;
111 const int &c_const = z;
112 const int &d_const = w;
122 return std::hash<int>()(v.x) ^ (std::hash<int>()(v.y) << 1);
128 bool operator()(
const glm::ivec2 &a,
const glm::ivec2 &b)
const noexcept
140 h ^= std::hash<int>{}(v.x) + 0x9e3779b9 + (h << 6) + (h >> 2);
141 h ^= std::hash<int>{}(v.y) + 0x9e3779b9 + (h << 6) + (h >> 2);
142 h ^= std::hash<int>{}(v.z) + 0x9e3779b9 + (h << 6) + (h >> 2);
143 h ^= std::hash<int>{}(v.w) + 0x9e3779b9 + (h << 6) + (h >> 2);
150 bool operator()(
const glm::ivec4 &a,
const glm::ivec4 &b)
const noexcept
156inline glm::vec4
adjust(
const glm::vec4 &v,
162 return glm::vec4{v.x + dx, v.y + dy, v.z + dz, v.w + dw};
165inline glm::vec4
adjust(
const glm::vec4 &v,
float dr)
167 return glm::vec4{v.x - dr, v.y + dr, v.z - dr, v.w + dr};
179template <
typename T>
struct Mat
217 std::fill(this->vector.begin(), this->vector.end(), value);
232 return this->vector[j * this->shape.x + i];
248 return this->vector[j * this->shape.x + i];
253 return this->vector[ij.y * this->shape.x + ij.x];
258 return this->vector[ij.y * this->shape.x + ij.x];
Definition algebra.hpp:23
glm::vec4 adjust(const glm::vec4 &v, float dx, float dy, float dz, float dw)
Definition algebra.hpp:156
void to_csv(const std::vector< glm::vec3 > &xyz, const std::string &fname)
Definition algebra.cpp:12
Definition algebra.hpp:127
bool operator()(const glm::ivec2 &a, const glm::ivec2 &b) const noexcept
Definition algebra.hpp:128
Definition algebra.hpp:119
size_t operator()(const glm::ivec2 &v) const noexcept
Definition algebra.hpp:120
Definition algebra.hpp:149
bool operator()(const glm::ivec4 &a, const glm::ivec4 &b) const noexcept
Definition algebra.hpp:150
Definition algebra.hpp:136
std::size_t operator()(const glm::ivec4 &v) const noexcept
Definition algebra.hpp:137
Mat class for basic manipulation of 2D matrices.
Definition algebra.hpp:180
glm::ivec2 shape
Dimensions of the matrix (rows x columns).
Definition algebra.hpp:183
T & operator()(int i, int j)
Access operator to get a reference to the element at (i, j).
Definition algebra.hpp:230
std::vector< T > vector
1D vector storing matrix elements in row-major order.
Definition algebra.hpp:181
const T & operator()(int i, int j) const
Const access operator to get the value of the element at (i, j).
Definition algebra.hpp:246
T & operator()(glm::ivec2 ij)
Definition algebra.hpp:251
Mat(glm::ivec2 shape)
Constructor to initialize a matrix with a given shape.
Definition algebra.hpp:198
const T & operator()(glm::ivec2 ij) const
Definition algebra.hpp:256
Mat(glm::ivec2 shape, T value)
Constructor to initialize a matrix with a given shape and value.
Definition algebra.hpp:214
Definition algebra.hpp:29
Definition algebra.hpp:47
Definition algebra.hpp:67