Beispiel #1
0
def _is_right_triangle(pts):
    side_a = _euclidean_dist(pts[0], pts[1])
    side_b = _euclidean_dist(pts[0], pts[2])
    side_c = _euclidean_dist(pts[1], pts[2])
    return any(
        math_utils.isclose(a ** 2 + b ** 2, c ** 2)
        for (a, b, c) in [
            (side_a, side_b, side_c),
            (side_a, side_c, side_b),
            (side_b, side_c, side_a),
        ])
Beispiel #2
0
def has_integer_length_shortest_route(a, b, c):
    shortest = min(
        _hypotenuse(a + b, c),
        _hypotenuse(a + c, b),
        _hypotenuse(b + c, a))
    return math_utils.isclose(round(shortest), shortest)