mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 21:49:18 +02:00
* Tpoint.Angle initial version using arctan2
This commit is contained in:
parent
bfb904640a
commit
5fb88cef00
@ -141,6 +141,11 @@ begin
|
|||||||
y:=y+dy;
|
y:=y+dy;
|
||||||
end;
|
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;
|
class operator TPoint.= (const apt1, apt2 : TPoint) : Boolean;
|
||||||
begin
|
begin
|
||||||
result:=(apt1.x=apt2.x) and (apt1.y=apt2.y);
|
result:=(apt1.x=apt2.x) and (apt1.y=apt2.y);
|
||||||
|
@ -59,6 +59,8 @@
|
|||||||
end;
|
end;
|
||||||
PSize =^TSize;
|
PSize =^TSize;
|
||||||
|
|
||||||
|
{ TPoint }
|
||||||
|
|
||||||
TPoint =
|
TPoint =
|
||||||
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
packed
|
packed
|
||||||
@ -79,6 +81,7 @@
|
|||||||
procedure SetLocation(ax,ay : Longint);
|
procedure SetLocation(ax,ay : Longint);
|
||||||
procedure Offset(const apt :TPoint);
|
procedure Offset(const apt :TPoint);
|
||||||
procedure Offset(dx,dy : Longint);
|
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 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;
|
||||||
class operator <> (const apt1, apt2 : TPoint): Boolean;
|
class operator <> (const apt1, apt2 : TPoint): Boolean;
|
||||||
|
@ -53,6 +53,8 @@ interface
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses math;
|
||||||
|
|
||||||
{$undef read_interface}
|
{$undef read_interface}
|
||||||
{$define read_implementation}
|
{$define read_implementation}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user