fix: Vec3 construct wasn't constexpr

This commit is contained in:
orng 2026-03-29 18:34:00 -05:00
parent 659b9c32cb
commit b630ec8800
2 changed files with 3 additions and 11 deletions

View file

@ -5,15 +5,6 @@
#include "AABB.h"
Vec3::Vec3(double x, double y, double z) {
if (x == -0.0) x = 0.0;
if (y == -0.0) y = 0.0;
if (z == -0.0) z = 0.0;
this->x = x;
this->y = y;
this->z = z;
}
Vec3 Vec3::vectorTo(const Vec3& p) const { return {p.x - x, p.y - y, p.z - z}; }
Vec3 Vec3::normalize() const {

View file

@ -9,8 +9,9 @@ class Vec3 {
public:
double x, y, z;
Vec3() {}
Vec3(double x, double y, double z);
constexpr Vec3() = default;
constexpr Vec3(const double x, const double y, const double z)
: x(x), y(y), z(z) {}
Vec3 vectorTo(const Vec3& p) const;
Vec3 normalize() const;