Skip to content

Commit b0de73b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b499d88 commit b0de73b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

physics/collisions.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
# Basic implementation of the collision of two circles.
2-
def circle_collision(fpos: tuple[float, float, float], spos: tuple[float, float, float]) -> bool:
2+
def circle_collision(
3+
fpos: tuple[float, float, float], spos: tuple[float, float, float]
4+
) -> bool:
35
# difference by XY axes
46
dx = fpos[0] - spos[0]
57
dy = fpos[1] - spos[1]
6-
7-
8+
89
# Euclidean distance between the centers of circles
910
distance = pow((pow(dx, 2) + pow(dy, 2)), 0.5)
10-
11+
1112
# minimum possible distance between circles, without collision
1213
min_distance = fpos[2] + fpos[2]
1314
collide = distance < min_distance
14-
15+
1516
# If actual distance smaller than minimal possible, cirlces collides
1617
return collide
1718

19+
1820
if __name__ == "__main__":
1921
from doctest import testmod
2022

0 commit comments

Comments
 (0)