diff options
Diffstat (limited to 'src/point.inl')
-rw-r--r-- | src/point.inl | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/point.inl b/src/point.inl index be5b3180..0184c37c 100644 --- a/src/point.inl +++ b/src/point.inl @@ -7,17 +7,13 @@ namespace floormat { constexpr uint32_t point::distance(point a, point b) { - Vector2i dist; - dist += (a.coord() - b.coord())*iTILE_SIZE2; - dist += Vector2i(a.offset()) - Vector2i(b.offset()); + Vector2i dist = a - b; return (uint32_t)Math::ceil(Math::sqrt(Vector2(dist).dot())); } constexpr uint32_t point::distance_l2(point a, point b) { - Vector2i dist; - dist += (a.coord() - b.coord())*iTILE_SIZE2; - dist += Vector2i(a.offset()) - Vector2i(b.offset()); + Vector2i dist = a - b; return (uint32_t)Math::abs(dist).sum(); } |