From aae525977ee259e9f559c152b06dd694513dfaff Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Sun, 12 Mar 2023 18:18:16 +0100 Subject: [PATCH] TAChart: Add function PointDist overload for TDoublePoint arguments. --- components/tachart/tageometry.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/tachart/tageometry.pas b/components/tachart/tageometry.pas index 4b4d7780df..14c259ecb8 100644 --- a/components/tachart/tageometry.pas +++ b/components/tachart/tageometry.pas @@ -76,6 +76,7 @@ function MeasureRotatedRect(const ASize: TPoint; AAngle: Double): TSize; function NextNumberSeq( const APoints: array of TDoublePoint; var AStart, AEnd: Integer): Boolean; function PointDist(const A, B: TPoint): Integer; inline; +function PointDist(const A, B: TDoublePoint): Double; inline; function PointDistX(const A, B: TPoint): Integer; inline; function PointDistY(const A, B: TPoint): Integer; inline; function PointLineDist(const P, A, B: TPoint): Integer; overload; @@ -558,6 +559,11 @@ begin Result := Min(Sqr(Int64(A.X) - B.X) + Sqr(Int64(A.Y) - B.Y), MaxInt); end; +function PointDist(const A, B: TDoublePoint): Double; +begin + Result := Sqrt(Sqr(A.X - B.X) + Sqr(A.Y - B.Y)); +end; + function PointDistX(const A, B: TPoint): Integer; begin Result := Min(Abs(Int64(A.X) - B.X), MaxInt);