* Tpoint.Angle initial version using arctan2

(cherry picked from commit 5fb88cef00)
This commit is contained in:
marcoonthegit 2022-12-30 19:34:03 +01:00
parent 12c586f22e
commit 66bfb69e96
3 changed files with 10 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -53,6 +53,8 @@ interface
implementation
uses math;
{$undef read_interface}
{$define read_implementation}