def get_closest_point_to_point(xy_point):
    pAB = get_closest_point_to_line(Red, Lime, xy_point)
    pAC = get_closest_point_to_line(Blue, Red, xy_point)
    pBC = get_closest_point_to_line(Lime, Blue, xy_point)

    # Get the distances per point and see which point is closer to our Point.
    dAB = get_distance_between_two_points(xy_point, pAB)
    dAC = get_distance_between_two_points(xy_point, pAC)
    dBC = get_distance_between_two_points(xy_point, pBC)

    lowest = dAB
    closest_point = pAB

    if (dAC < lowest):
        lowest = dAC
        closest_point = pAC

    if (dBC < lowest):
        lowest = dBC
        closest_point = pBC

    # Change the xy value to a value which is within the reach of the lamp.
    cx = closest_point.x
    cy = closest_point.y

    return XYPoint(cx, cy)
Used to find the closest point to an unreproducible Color is unreproducible
dataset/ETHPy150Open sontek/bulby/bulby/color.py/get_closest_point_to_point