I am trying to verify when 3 points (double) are collinear in 2-D. I have found different Pascal functions that return true if this is verified; those functions use integer
David's code will work, but you should get the tolerance as a function of the parameters, like so:
function Collinear(const x1, y1, x2, y2, x3, y3: Double): Boolean; inline;
var
tolerance: double;
begin
tolerance := abs(max(x1,x2,x3,y1,y2,y3)) * 0.000001;
Result := abs((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) < tolerance;
end;
If you don't do that and use a constant instead you can run into weird errors with large values for x1..y3.