diff options
author | Keuin <[email protected]> | 2022-04-12 13:03:05 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-12 13:03:05 +0800 |
commit | 60a3e2aedda225591f10a360575250b201aadd53 (patch) | |
tree | 09cfb81976dc8b2d8e4f050ac3745ee72686aa6f /vec.h | |
parent | afad858dada4d2735d5408a4eca064fb605e4578 (diff) |
Add vec3::mod2.
Diffstat (limited to 'vec.h')
-rw-r--r-- | vec.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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()); } |