summaryrefslogtreecommitdiff
path: root/lowlevelunit.pas
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-08 15:59:12 +0100
committerErich Eckner <git@eckner.net>2017-11-08 16:02:50 +0100
commita9f2070dcf401d9362c918c913f147ed9bf32f47 (patch)
tree2ce3282c7c24a238f10e9d75c2ddbaa0d176b6fe /lowlevelunit.pas
parent26eb5df62355ed6e6f00c334d72d52ab3bce99c4 (diff)
downloadunits-a9f2070dcf401d9362c918c913f147ed9bf32f47.tar.xz
lowlevelunit.pas: t2x2Int64 & *modulo neu
Diffstat (limited to 'lowlevelunit.pas')
-rw-r--r--lowlevelunit.pas54
1 files changed, 54 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index 36aa4ae..fd83c11 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -19,6 +19,7 @@ type
tExtPoint = array['x'..'y'] of extended;
t2x2Longint = array['x'..'y','x'..'y'] of longint;
t2x2Extended = array['x'..'y','x'..'y'] of extended;
+ t2x2Int64 = array['x'..'y','x'..'y'] of int64;
tExtPointArray = specialize tArray<tExtPoint>;
pTExtPointArray = ^tExtPointArray;
tExtendedArray = specialize tArray<extended>;
@@ -42,6 +43,7 @@ type
tKantenFilterTyp = (kfTiefpass,kfHochpass);
operator = (x1,x2: t2x2Extended): boolean;
+operator = (x1,x2: t2x2Int64): boolean;
operator = (x1,x2: tInt64Point): boolean;
operator = (x1,x2: tIntPoint): boolean;
operator = (x1,x2: tExtPoint): boolean;
@@ -61,6 +63,9 @@ operator * (a: extended; x: tIntPoint): tExtPoint;
operator * (a: extended; x: tExtPoint): tExtPoint;
function round(x: tExtPoint): tInt64Point; overload;
+function symmetrischModulo(x,m: tInt64Point): tInt64Point; overload;
+function symmetrischModulo(x: tExtPoint; m: tInt64Point): tExtPoint; overload;
+function modulo(x,m: tInt64Point): tInt64Point;
function signSqr(x: extended): extended; inline;
function myTimeToStr(t: extended): string;
@@ -162,6 +167,16 @@ begin
result:=result and (x1[c,d]=x2[c,d]);
end;
+operator = (x1,x2: t2x2Int64): boolean;
+var
+ c,d: char;
+begin
+ result:=true;
+ for c:='x' to 'y' do
+ for d:='x' to 'y' do
+ result:=result and (x1[c,d]=x2[c,d]);
+end;
+
operator = (x1,x2: tInt64Point): boolean;
var
c: char;
@@ -314,6 +329,45 @@ begin
result[c]:=round(x[c]);
end;
+function symmetrischModulo(x,m: tInt64Point): tInt64Point;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do begin
+ result[c]:=x[c];
+ while 2*result[c]<-m[c] do
+ result[c]:=result[c]+m[c];
+ while 2*result[c]>=m[c] do
+ result[c]:=result[c]-m[c];
+ end;
+end;
+
+function symmetrischModulo(x: tExtPoint; m: tInt64Point): tExtPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do begin
+ result[c]:=x[c];
+ while 2*result[c]<-m[c] do
+ result[c]:=result[c]+m[c];
+ while 2*result[c]>=m[c] do
+ result[c]:=result[c]-m[c];
+ end;
+end;
+
+function modulo(x,m: tInt64Point): tInt64Point;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do begin
+ result[c]:=x[c];
+ while result[c]<0 do
+ result[c]:=result[c]+m[c];
+ while result[c]>=m[c] do
+ result[c]:=result[c]-m[c];
+ end;
+end;
+
function signSqr(x: extended): extended;
begin
result:=sign(x)*sqr(x);