Mega Code Archive

 
Categories / Delphi / Graphic
 

Determine if 3 points are collinear in 2D

Title: Determine if 3 points are collinear in 2D? function Collinear(x1, y1, x2, y2, x3, y3: Double): Boolean; begin Result := (((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) = 0); end; (* End Of Collinear *) // vérifier si 3 points appartiennent à une même droite bidimensionnelle // c.a.d s'ils sont alignés.