summaryrefslogtreecommitdiff
path: root/vec.h
diff options
context:
space:
mode:
Diffstat (limited to 'vec.h')
-rw-r--r--vec.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/vec.h b/vec.h
index 017b0a9..bf40e7d 100644
--- a/vec.h
+++ b/vec.h
@@ -71,6 +71,11 @@ struct vec3 {
}
}
+ // Squared module
+ T mod2() const {
+ return x * x + y * y + z * z;
+ }
+
vec3 unit_vec() const {
return *this * (1.0 / norm());
}