//计算点P到直线的距离,AB可以平行于坐标轴。delphi
function LenPToLine(P, A, B: TVector3f): Extended;
var
A1, B1, C1: Extended;
begin
if A.X = B.X then
begin
Result := P.X - A.X;
Exit;
end;
if A.Y = B.Y then
begin
Result := P.Y - A.Y;
Exit;
end;
A1 := GetA(A, B);
B1 := GetB(A, B);
C1 := GetC(A, B);
Result := LenByABC(P, A1, B1, C1);
end;