Return the Euclidean distance between two 2-D points. >>> _euclidean_distance((0.0, 0.0), (3.0, 4.0)) 5.0 >>> _euclidean_distance((1.0, 1.0), (1.0, 1.0)) 0.0
(
point_a: tuple[float, float],
point_b: tuple[float, float],
)
| 17 | |
| 18 | |
| 19 | def _euclidean_distance( |
| 20 | point_a: tuple[float, float], |
| 21 | point_b: tuple[float, float], |
| 22 | ) -> float: |
| 23 | """Return the Euclidean distance between two 2-D points. |
| 24 | |
| 25 | >>> _euclidean_distance((0.0, 0.0), (3.0, 4.0)) |
| 26 | 5.0 |
| 27 | >>> _euclidean_distance((1.0, 1.0), (1.0, 1.0)) |
| 28 | 0.0 |
| 29 | """ |
| 30 | return math.hypot(point_b[0] - point_a[0], point_b[1] - point_a[1]) |
| 31 | |
| 32 | |
| 33 | def _perpendicular_distance( |
no outgoing calls
no test coverage detected