def direction_correct(points, i1, i2, i3): p1, p2, p3 = points[i1], points[i2], points[i3] d = Point.direction(p1, p2, p3) return (d > 0 or d == 0 and p1.dist_to_point(p2) > p1.dist_to_point(p3))
def left_points(points, p1, p2): '''Points at the left of vector p1->p2 and p1, p2''' return ([p1] + list(filter(lambda p: Point.direction(p1, p2, p) < 0, points)) + [p2])