in reply to Check if line is straight
Of your 3 points, find the 2 extreme points. Look to see if delta_X for the extreme points is larger than delta_Y. If so, your problem is mostly horizontal, otherwise it is mostly vertical. A person probably should convert the problem to either purely horizontal or purely vertical (by pivoting on the left/bottom point). First, subtract the (X,Y) coordinates of that left/bottom point from all the points, leaving that left/bottom point at the origin. Then rotate the other points so that the other extreme point either has an X of 0 (vertical problem) or a Y of 0 (horizontal problem). If the Y coordinate of the middle point (horizontal problem) is within the tolerance of 0, the triplet appears to be co-linear. The problem is left as to how to choose a tolerance. In general, that middle point will almost never have a Y coordinate of 0. The same as true of the other extreme point. Theoretically we can rotate it to make the coordinate equal to 0, but finite precision floating point arithmetic will usually not allow it to become 0. It should be closer to 0 than the middle point.