diff --git a/Projects/SAMufasaGUI/project1.lpi b/Projects/SAMufasaGUI/project1.lpi
index 4df4806..29e867f 100644
--- a/Projects/SAMufasaGUI/project1.lpi
+++ b/Projects/SAMufasaGUI/project1.lpi
@@ -33,7 +33,7 @@
-
+
@@ -41,7 +41,7 @@
-
+
@@ -172,8 +172,8 @@
-
-
+
+
@@ -305,7 +305,7 @@
-
+
@@ -315,7 +315,7 @@
-
+
@@ -331,15 +331,17 @@
-
+
-
+
-
+
+
+
@@ -353,9 +355,7 @@
-
-
@@ -377,7 +377,7 @@
-
+
@@ -392,7 +392,7 @@
-
+
@@ -404,10 +404,10 @@
-
-
-
-
+
+
+
+
@@ -515,9 +515,9 @@
-
+
-
+
@@ -539,7 +539,7 @@
-
+
@@ -559,7 +559,7 @@
-
+
@@ -691,7 +691,7 @@
-
+
@@ -750,7 +750,7 @@
-
+
@@ -834,7 +834,7 @@
-
+
@@ -842,10 +842,10 @@
-
-
+
+
-
+
@@ -861,8 +861,8 @@
-
-
+
+
@@ -888,7 +888,7 @@
-
+
@@ -922,8 +922,8 @@
-
-
+
+
@@ -931,15 +931,13 @@
-
-
-
-
-
+
+
+
@@ -955,9 +953,7 @@
-
-
@@ -971,132 +967,139 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/Tests/PS/dtmtest2.txt b/Tests/PS/dtmtest2.txt
index 1165df9..b093fb5 100644
--- a/Tests/PS/dtmtest2.txt
+++ b/Tests/PS/dtmtest2.txt
@@ -11,6 +11,8 @@ var
ppdtm: pdtm;
w,h,x,y,dtm,i: integer;
+ a: extended;
+
p,pp: TPointArray;
c,t,asz,ash: TIntegerArray;
@@ -47,4 +49,10 @@ begin
inttostr(p[0].x) + ', ' + inttostr(p[0].y));
movemouse(p[0].x,p[0].y);
end;
+
+ if FindDTMRotated(dtm, x, y, 0, 0, w-1, h-1, -3.14, 3.14, 0.05, a) then
+ begin
+ writeln('Found DTM at ' + inttostr(x) + ', ' + inttostr(y) + ' Angle: ' + FloatToStr(a));
+ movemouse(x,y);
+ end;
end.
diff --git a/Units/MMLAddon/PSInc/Wrappers/dtm.inc b/Units/MMLAddon/PSInc/Wrappers/dtm.inc
index 2378d34..f527bc3 100644
--- a/Units/MMLAddon/PSInc/Wrappers/dtm.inc
+++ b/Units/MMLAddon/PSInc/Wrappers/dtm.inc
@@ -8,7 +8,30 @@ begin
Result := CurrThread.Client.MDTM.FindDTMs(DTM, p, x1, y1, x2, y2);
end;
+function ps_FindDTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2:
+ Integer; sAngle, eAngle, aStep: Extended;
+ var aFound: Extended): Boolean;
+begin
+ Result := CurrThread.Client.MDTM.FindDTMRotated(DTM, x, y, x1, y1, x2, y2,
+ sAngle, eAngle, aStep, aFound);
+end;
+function ps_FindDTMsRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2:
+ Integer; sAngle, eAngle, aStep: Extended;
+ var aFound: Extended): Boolean;
+begin
+ Result := CurrThread.Client.MDTM.FindDTMRotated(DTM, x, y, x1, y1, x2, y2,
+ sAngle, eAngle, aStep, aFound);
+end;
+
+function ps_FindDTMsRotated(DTM: Integer; var Points: TPointArray; x1,
+ y1, x2, y2: Integer; sAngle, eAngle,
+ aStep: Extended; var aFound: T2DExtendedArray)
+ : Boolean;
+begin
+ Result := CurrThread.Client.MDTM.FindDTMsRotated(DTM, Points, x1, y1, x2, y2,
+ sAngle, eAngle, aStep, aFound);
+end;
function ps_DTMFromString(DTMString: String): Integer;
var
diff --git a/Units/MMLAddon/PSInc/pscompile.inc b/Units/MMLAddon/PSInc/pscompile.inc
index 0388323..82d3bf4 100644
--- a/Units/MMLAddon/PSInc/pscompile.inc
+++ b/Units/MMLAddon/PSInc/pscompile.inc
@@ -8,7 +8,7 @@ Sender.Comp.AddTypes('TDTMPointDef', 'record x, y, Color, Tolerance, AreaSize, A
Sender.Comp.AddTypes('TDTMPointDefArray', 'Array Of TDTMPointDef;');
Sender.Comp.AddTypes('TDTM','record MainPoint: TDTMPointDef; SubPoints: TDTMPointDefArray; end;');
Sender.Comp.AddTypeS('pDTM','record p: TPointArray; c, t, asz, ash: TIntegerArray; end');
-
+Sender.Comp.AddTypeS('T2DExtendedArray', 'array of array of extended');
Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
Sender.AddFunction(@psWriteln,'procedure writeln(s : string);');
@@ -23,6 +23,8 @@ Sender.AddFunction(@ps_DTMFromString, 'function DTMFromString(DTMString: String)
Sender.AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);');
Sender.AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;');
Sender.AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; var p: TPointArray; x1, y1, x2, y2: Integer): Boolean;');
+Sender.AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; var aFound: Extended): Boolean;');
+Sender.AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; var Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; var aFound: T2DExtendedArray) : Boolean;');
Sender.AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;');
Sender.AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;');
diff --git a/Units/MMLCore/dtm.pas b/Units/MMLCore/dtm.pas
index caa7e46..9ea902e 100644
--- a/Units/MMLCore/dtm.pas
+++ b/Units/MMLCore/dtm.pas
@@ -425,8 +425,8 @@ begin
MaxSubPointDist.Y := Max(DTM.p[I].y, MaxSubPointDist.Y);
end;
- X2 := X2 - MaxSubPointDist.X - 1;
- Y2 := Y2 - MaxSubPointDist.Y - 1;
+ X2 := X2 - MaxSubPointDist.X;
+ Y2 := Y2 - MaxSubPointDist.Y;
X1 := X1 + MaxSubPointDist.X;
Y1 := Y1 + MaxSubPointDist.Y;
{If X2 > X1 then
@@ -521,8 +521,8 @@ Begin
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
End;
- X2 := X2 - MaxSubPointDist.X - 1;
- Y2 := Y2 - MaxSubPointDist.Y - 1;
+ X2 := X2 - MaxSubPointDist.X;
+ Y2 := Y2 - MaxSubPointDist.Y;
X1 := X1 + MaxSubPointDist.X;
Y1 := Y1 + MaxSubPointDist.Y;
{If X2 > X1 then
@@ -615,8 +615,8 @@ Begin
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
End;
- X2 := X2 - MaxSubPointDist.X - 1;
- Y2 := Y2 - MaxSubPointDist.Y - 1;
+ X2 := X2 - MaxSubPointDist.X;
+ Y2 := Y2 - MaxSubPointDist.Y;
X1 := X1 + MaxSubPointDist.X;
Y1 := Y1 + MaxSubPointDist.Y;
{If X2 > X1 then
@@ -751,8 +751,8 @@ Begin
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
End;
- X2 := X2 - MaxSubPointDist.X - 1;
- Y2 := Y2 - MaxSubPointDist.Y - 1;
+ X2 := X2 - MaxSubPointDist.X;
+ Y2 := Y2 - MaxSubPointDist.Y;
X1 := X1 + MaxSubPointDist.X;
Y1 := Y1 + MaxSubPointDist.Y;
{If X2 > X1 then