summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--maths.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/maths.hpp b/maths.hpp
index ef2dbfb..98a318f 100644
--- a/maths.hpp
+++ b/maths.hpp
@@ -163,6 +163,8 @@ struct v3 {
v3(T x, v2<T> yz) : x(x), y(yz.x), z(yz.y) {}
v3(T x, T y, T z) : x(x), y(y), z(z) {}
+ v2<T> xy() const { return v2<T>(x, y); }
+
bool operator>(const v3<T>& other) const {
return x > other.x && y > other.y && z > other.z;
}
@@ -309,6 +311,9 @@ struct v4 {
v4(T x, v3<T> yzw) : x(x), y(yzw.x), z(yzw.y), w(yzw.z) {}
v4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
+ v3<T> xyz() const { return v3<T>(x, y, z); }
+ v2<T> xy() const { return v2<T>(x, y); }
+
bool operator>(const v4<T>& other) const {
return x > other.x && y > other.y && z > other.z && w > other.w;
}