summaryrefslogtreecommitdiffhomepage
path: root/Utils-inl.h
blob: 01e0ca67e0d90426a4cc35cc06cc48f020925760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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));
}