Skip to content

Commit 19c9cfd

Browse files
committed
restore old distance implementation
1 parent 53d76c3 commit 19c9cfd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

apps/bot_manager/lib/math/vector.ex

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ defmodule BotManager.Math.Vector do
5656
}
5757
end
5858

59-
def distance(x, y) do
60-
sub(x, y)
61-
|> norm()
62-
end
63-
6459
def deg2rad(deg) do
6560
deg * :math.pi() / 180
6661
end
62+
63+
def distance(%{x: x1, y: y1}, %{x: x2, y: y2}) do
64+
:math.sqrt(:math.pow(x2 - x1, 2) + :math.pow(y2 - y1, 2))
65+
end
6766
end

0 commit comments

Comments
 (0)