25void to_csv(
const std::vector<glm::vec3> &xyz,
const std::string &fname);
34 return std::hash<int>()(v.x) ^ (std::hash<int>()(v.y) << 1);
40 bool operator()(
const glm::ivec2 &a,
const glm::ivec2 &b)
const noexcept
49 std::size_t
operator()(
const glm::ivec4 &v)
const noexcept
52 h ^= std::hash<int>{}(v.x) + 0x9e3779b9 + (h << 6) + (h >> 2);
53 h ^= std::hash<int>{}(v.y) + 0x9e3779b9 + (h << 6) + (h >> 2);
54 h ^= std::hash<int>{}(v.z) + 0x9e3779b9 + (h << 6) + (h >> 2);
55 h ^= std::hash<int>{}(v.w) + 0x9e3779b9 + (h << 6) + (h >> 2);
62 bool operator()(
const glm::ivec4 &a,
const glm::ivec4 &b)
const noexcept
68inline glm::vec4
adjust(
const glm::vec4 &v,
74 return glm::vec4{v.x + dx, v.y + dy, v.z + dz, v.w + dw};
77inline glm::vec4
adjust(
const glm::vec4 &v,
float dr)
79 return glm::vec4{v.x - dr, v.y + dr, v.z - dr, v.w + dr};
91template <
typename T>
struct Mat
129 std::fill(this->vector.begin(), this->vector.end(), value);
144 return this->vector[j * this->shape.x + i];
160 return this->vector[j * this->shape.x + i];
165 return this->vector[ij.y * this->shape.x + ij.x];
170 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:68
void to_csv(const std::vector< glm::vec3 > &xyz, const std::string &fname)
Definition algebra.cpp:13
Definition algebra.hpp:39
bool operator()(const glm::ivec2 &a, const glm::ivec2 &b) const noexcept
Definition algebra.hpp:40
Definition algebra.hpp:31
size_t operator()(const glm::ivec2 &v) const noexcept
Definition algebra.hpp:32
Definition algebra.hpp:61
bool operator()(const glm::ivec4 &a, const glm::ivec4 &b) const noexcept
Definition algebra.hpp:62
Definition algebra.hpp:48
std::size_t operator()(const glm::ivec4 &v) const noexcept
Definition algebra.hpp:49
Mat class for basic manipulation of 2D matrices.
Definition algebra.hpp:92
glm::ivec2 shape
Dimensions of the matrix (rows x columns).
Definition algebra.hpp:95
T & operator()(int i, int j)
Access operator to get a reference to the element at (i, j).
Definition algebra.hpp:142
std::vector< T > vector
1D vector storing matrix elements in row-major order.
Definition algebra.hpp:93
const T & operator()(int i, int j) const
Const access operator to get the value of the element at (i, j).
Definition algebra.hpp:158
T & operator()(glm::ivec2 ij)
Definition algebra.hpp:163
Mat(glm::ivec2 shape)
Constructor to initialize a matrix with a given shape.
Definition algebra.hpp:110
const T & operator()(glm::ivec2 ij) const
Definition algebra.hpp:168
Mat(glm::ivec2 shape, T value)
Constructor to initialize a matrix with a given shape and value.
Definition algebra.hpp:126