diff options
author | BuildTools <unconfigured@null.spigotmc.org> | 2023-11-20 08:23:08 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-12-17 20:43:53 +0100 |
commit | ee9562c767631fbec6b444cf18f2435d24848e93 (patch) | |
tree | 8c5a770d6cf6d01c6b92247ae89522f9165967ef /src/openvic-simulation/types | |
parent | e6b455b8924948761dbd792756303efe18875c6d (diff) |
Additional adjacency loading
Diffstat (limited to 'src/openvic-simulation/types')
-rw-r--r-- | src/openvic-simulation/types/Vector.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/openvic-simulation/types/Vector.hpp b/src/openvic-simulation/types/Vector.hpp index 327806d..89fe12f 100644 --- a/src/openvic-simulation/types/Vector.hpp +++ b/src/openvic-simulation/types/Vector.hpp @@ -14,6 +14,16 @@ namespace OpenVic { constexpr vec2_t(T new_val) : x { new_val }, y { new_val } {} constexpr vec2_t(T new_x, T new_y) : x { new_x }, y { new_y } {} + constexpr vec2_t(vec2_t const&) = default; + constexpr vec2_t(vec2_t&&) = default; + constexpr vec2_t& operator=(vec2_t const&) = default; + constexpr vec2_t& operator=(vec2_t&&) = default; + + template<typename S> + constexpr explicit operator vec2_t<S>() { + return { static_cast<S>(x), static_cast<S>(y) }; + } + constexpr vec2_t abs() const { return { x >= 0 ? x : -x, y >= 0 ? y : -y }; } |