def point_in_segment(ac, b):
(a,c) = ac<EOL>abc = [np.asarray(u) for u in (a,b,c)]<EOL>if any(len(u.shape) > <NUM_LIT:1> for u in abc): (a,b,c) = [np.reshape(u,(len(u),-<NUM_LIT:1>)) for u in abc]<EOL>else:                                  (a,b,c) = abc<EOL>vab = b - a<EOL>vbc = c - b<EOL>vac = c - a<EOL>dab = np.sqrt(np.sum(vab**<NUM_LIT:2>, axis=<NUM_LIT:0>))<EOL>dbc = np.sqrt(np.sum(vbc**<NUM_LIT:2>, axis=<NUM_LIT:0>))<EOL>dac = np.sqrt(np.sum(vac**<NUM_LIT:2>, axis=<NUM_LIT:0>))<EOL>return np.isclose(dab + dbc, dac) & ~np.isclose(dac,dab) & ~np.isclose(dac,dbc)<EOL>
point_in_segment((a,b), c) yields True if point x is in segment (a,b) and False otherwise. Note
that this differs from point_on_segment in that a point that if c is equal to a or b it is
considered 'on' but not 'in' the segment.