added grid3. and fixed a minor issue in the backfill.

This commit is contained in:
Yggdrasil75
2025-12-01 14:55:38 -05:00
parent 8d5bf80ec6
commit 137042c18f
4 changed files with 599 additions and 7 deletions

View File

@@ -15,7 +15,14 @@ public:
Vec3(float scalar) : x(scalar), y(scalar), z(scalar) {}
Vec3(const class Vec2& vec2, float z = 0.0f);
Vec3& move(const Vec3 newpos) {
x = newpos.x;
y = newpos.y;
z = newpos.z;
return *this;
}
// Arithmetic operations
Vec3 operator+(const Vec3& other) const {
return Vec3(x + other.x, y + other.y, z + other.z);
@@ -303,6 +310,12 @@ public:
std::string toString() const {
return "(" + std::to_string(x) + ", " + std::to_string(y) + ", " + std::to_string(z) + ")";
}
struct Hash {
std::size_t operator()(const Vec3& v) const {
return std::hash<float>()(v.x) ^ (std::hash<float>()(v.y) << 1) ^ (std::hash<float>()(v.z) << 2);
}
};
};
inline std::ostream& operator<<(std::ostream& os, const Vec3& vec) {