summaryrefslogtreecommitdiffhomepage
path: root/Utils-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'Utils-inl.h')
-rw-r--r--Utils-inl.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/Utils-inl.h b/Utils-inl.h
new file mode 100644
index 0000000..01e0ca6
--- /dev/null
+++ b/Utils-inl.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <cmath>
+
+
+template <typename V, typename T>
+T
+dist2(const V& lhs, const V& rhs)
+{
+ return std::sqrt(
+ std::pow(lhs.x - rhs.x, 2) +
+ std::pow(lhs.y - rhs.y, 2));
+}
+
+
+template <typename V, typename T>
+T
+dist3(const V& lhs, const V& rhs)
+{
+ return std::sqrt(
+ std::pow(lhs.x - rhs.x, 2) +
+ std::pow(lhs.y - rhs.y, 2) +
+ std::pow(lhs.z - rhs.z, 2));
+}