Esempio n. 1
0
def test_euclidean_dist_squared() -> None:
    """
        Tests if euclidean_dist_squared works correctly.
    """
    point_1 = Point(x=3, y=4)
    point_2 = Point(x=0, y=0)
    point_3 = Point(x=3, y=0)
    point_4 = Point(x=6, y=4)

    assert point_1.euclidean_dist_squared(point_1) == 0
    assert point_1.euclidean_dist_squared(point_2) == 25
    assert point_1.euclidean_dist_squared(point_3) == 16
    assert point_1.euclidean_dist_squared(point_4) == 9
Esempio n. 2
0
    def _radial_key(_point: Point):
        """
        Defines comparison key for sorting.

        Args:
            _point: Some point.

        Returns: Euclidean distance from starting point.

        """
        return _point.euclidean_dist_squared(start_point)