I want to know a piece of a code which can actually tell me if 3 points in a 2D space are on the same line or not. A pseudo-code is also sufficient but Python is better.
y - y0 = a(x-x0) (1) while a = (y1 - y0)/(x1 - x0) and A(x0, y0)B(x1, y1)C(x2, y2). See whether C statisfies (1). You just replace the appropriate values.