aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/tform.h3
-rw-r--r--src/math/vector.h6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/math/tform.h b/src/math/tform.h
index 2a654b8..74186f8 100644
--- a/src/math/tform.h
+++ b/src/math/tform.h
@@ -14,8 +14,7 @@ class Transform {
Quaternion rot;
Vector3 scale;
- constexpr Transform(Vector3 loc, Quaternion rot, Vector3 scale) : loc{loc}, rot{rot}, scale{scale} {
- }
+ constexpr Transform(Vector3 loc, Quaternion rot, Vector3 scale) : loc{loc}, rot{rot}, scale{scale} {}
constexpr Transform opposite() const & {
return {-loc, rot.conjugate(), 1.f / scale};
diff --git a/src/math/vector.h b/src/math/vector.h
index d755c89..fcfc5bd 100644
--- a/src/math/vector.h
+++ b/src/math/vector.h
@@ -33,6 +33,12 @@ struct Vector2 {
return *this + (-other);
}
+ constexpr Vector2 operator+=(const Vector2& other) & {
+ x += other.x;
+ y += other.y;
+ return *this;
+ }
+
constexpr float det(const Vector2& other) const & {
return this->x * other.y - other.x * this->y;
}