mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-06 16:58:50 +02:00
* Patch from Ondrej Pokorny to implement - and * operators for TPointF
git-svn-id: trunk@32817 -
This commit is contained in:
parent
96257e11d7
commit
353f5340dc
@ -120,6 +120,10 @@ type
|
|||||||
class operator <> (const apt1, apt2 : TPointF): Boolean;
|
class operator <> (const apt1, apt2 : TPointF): Boolean;
|
||||||
class operator + (const apt1, apt2 : TPointF): TPointF;
|
class operator + (const apt1, apt2 : TPointF): TPointF;
|
||||||
class operator - (const apt1, apt2 : TPointF): TPointF;
|
class operator - (const apt1, apt2 : TPointF): TPointF;
|
||||||
|
class operator - (const apt1 : TPointF): TPointF;
|
||||||
|
class operator * (const apt1, apt2: TPointF): Single; // scalar product
|
||||||
|
class operator * (const apt1: TPointF; afactor: single): TPointF;
|
||||||
|
class operator * (afactor: single; const apt1: TPointF): TPointF;
|
||||||
end;
|
end;
|
||||||
{ TRectF }
|
{ TRectF }
|
||||||
|
|
||||||
@ -600,6 +604,21 @@ begin
|
|||||||
result:=NOT (SameValue(apt1.x,apt2.x) and Samevalue(apt1.y,apt2.y));
|
result:=NOT (SameValue(apt1.x,apt2.x) and Samevalue(apt1.y,apt2.y));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class operator TPointF. * (const apt1, apt2: TPointF): Single;
|
||||||
|
begin
|
||||||
|
result:=apt1.x*apt2.x + apt1.y*apt2.y;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TPointF. * (afactor: single; const apt1: TPointF): TPointF;
|
||||||
|
begin
|
||||||
|
result:=apt1.Scale(afactor);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TPointF. * (const apt1: TPointF; afactor: single): TPointF;
|
||||||
|
begin
|
||||||
|
result:=apt1.Scale(afactor);
|
||||||
|
end;
|
||||||
|
|
||||||
class operator TPointF.+ (const apt1, apt2 : TPointF): TPointF;
|
class operator TPointF.+ (const apt1, apt2 : TPointF): TPointF;
|
||||||
begin
|
begin
|
||||||
result.x:=apt1.x+apt2.x;
|
result.x:=apt1.x+apt2.x;
|
||||||
@ -612,6 +631,12 @@ begin
|
|||||||
result.y:=apt1.y-apt2.y;
|
result.y:=apt1.y-apt2.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class operator TPointF. - (const apt1: TPointF): TPointF;
|
||||||
|
begin
|
||||||
|
Result.x:=-apt1.x;
|
||||||
|
Result.y:=-apt1.y;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPointF.SetLocation(const apt :TPointF);
|
procedure TPointF.SetLocation(const apt :TPointF);
|
||||||
begin
|
begin
|
||||||
x:=apt.x; y:=apt.y;
|
x:=apt.x; y:=apt.y;
|
||||||
|
Loading…
Reference in New Issue
Block a user