Skip to content
Snippets Groups Projects
Forked from agnumpde / dune-tectonic
157 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
max_distance.py 410 B
from itertools import combinations


def square_distance(x, y):
    return sum([(xi-yi)**2 for xi, yi in zip(x, y)])


def max_distance(points):
    max_square_distance = 0
    max_pair = (0, 0)
    for pair in combinations(points, 2):
        sq_dist = square_distance(*pair)

        if sq_dist > max_square_distance:
            max_square_distance = sq_dist
            max_pair = pair
    return max_pair