if self.n > len(self.points):
raise ValueError("n can"t be higher than the number of points in the PyntCloud.")
remaining_points = self.points.values
solution_set = list()
solution_set.append(remaining_points.pop(
random.randint(0, len(remaining_points) - 1)))
for _ in range(self.n - 1):
distances = [self.cal_distance(p, solution_set[0]) for p in remaining_points]
for i, p in enumerate(remaining_points):
for j, s in enumerate(solution_set):
distances[i] = min(distances[i], self.cal_distance(p, s))
solution_set.append(remaining_points.pop(distances.index(max(distances))))