def nearestPoint(a,b,c):
    magnitude = np.linalg.norm(b-a)
    if magnitude == 0:
        raise Exception, "Line segment cannot be 0 length"
    return (b-a) * np.dot((c-a) / magnitude, (b-a) / magnitude) + a


# pts = np.array([[1,1],[2,2],[3,3],[4,4]])
# pts2 = np.array([[1,0],[2,0],[3,0],[4,0]])
# print alignPoints(pts2, start = pts[0], end = pts[0]+pts[0])
# # print findCorner(pts,pts2)
nearest point to point c on line a_b
dataset/ETHPy150Open google/roboto/scripts/lib/fontbuild/alignpoints.py/nearestPoint