def point_on_line(ab, c):
    '''
    point_on_line((a,b), c) yields True if point x is on line (a,b) and False otherwise.
    '''
    (a,b) = ab
    abc = [np.asarray(u) for u in (a,b,c)]
    if any(len(u.shape) == 2 for u in abc): (a,b,c) = [np.reshape(u,(len(u),-1)) for u in abc]
    else:                                   (a,b,c) = abc
    vca = a - c
    vcb = b - c
    uba = czdivide(vba, np.sqrt(np.sum(vba**2, axis=0)))
    uca = czdivide(vca, np.sqrt(np.sum(vca**2, axis=0)))
    return (np.isclose(np.sqrt(np.sum(vca**2, axis=0)), 0) |
            np.isclose(np.sqrt(np.sum(vcb**2, axis=0)), 0) |
            np.isclose(np.abs(np.sum(uba*uca, axis=0)), 1))
def point_on_line ( ab , c ) : ( a , b ) = ab abc = [ np . asarray ( u ) for u in ( a , b , c ) ] if any ( len ( u . shape ) == 2 for u in abc ) : ( a , b , c ) = [ np . reshape ( u , ( len ( u ) , - 1 ) ) for u in abc ] else : ( a , b , c ) = abc vca = a - c vcb = b - c uba = czdivide ( vba , np . sqrt ( np . sum ( vba ** 2 , axis = 0 ) ) ) uca = czdivide ( vca , np . sqrt ( np . sum ( vca ** 2 , axis = 0 ) ) ) return ( np . isclose ( np . sqrt ( np . sum ( vca ** 2 , axis = 0 ) ) , 0 ) | np . isclose ( np . sqrt ( np . sum ( vcb ** 2 , axis = 0 ) ) , 0 ) | np . isclose ( np . abs ( np . sum ( uba * uca , axis = 0 ) ) , 1 ) )
point_on_line((a,b), c) yields True if point x is on line (a,b) and False otherwise.