diff --git a/rtl/inc/typshrd.inc b/rtl/inc/typshrd.inc index 68f3034359..eb9e05a0f7 100644 --- a/rtl/inc/typshrd.inc +++ b/rtl/inc/typshrd.inc @@ -141,6 +141,11 @@ begin y:=y+dy; end; +function TPoint.Angle(const pt: TPoint): Single; +begin + result:=ArcTan2(y-pt.y,x-pt.x); +end; + class operator TPoint.= (const apt1, apt2 : TPoint) : Boolean; begin result:=(apt1.x=apt2.x) and (apt1.y=apt2.y); diff --git a/rtl/inc/typshrdh.inc b/rtl/inc/typshrdh.inc index ee6d4b1ea8..d62adad1bf 100644 --- a/rtl/inc/typshrdh.inc +++ b/rtl/inc/typshrdh.inc @@ -59,6 +59,8 @@ end; PSize =^TSize; + { TPoint } + TPoint = {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT} packed @@ -79,6 +81,7 @@ procedure SetLocation(ax,ay : Longint); procedure Offset(const apt :TPoint); procedure Offset(dx,dy : Longint); + function Angle(const pt : TPoint):Single; class function PointInCircle(const apt, acenter: TPoint; const aradius: Integer): Boolean; static; inline; class operator = (const apt1, apt2 : TPoint) : Boolean; class operator <> (const apt1, apt2 : TPoint): Boolean; diff --git a/rtl/win32/windows.pp b/rtl/win32/windows.pp index 9bf2deb0e9..801aa93b29 100644 --- a/rtl/win32/windows.pp +++ b/rtl/win32/windows.pp @@ -53,6 +53,8 @@ interface implementation +uses math; + {$undef read_interface} {$define read_implementation}