mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-30 14:50:18 -05:00
More fixes for FindDTM and FindDTMs.
The rotated variant do not function correctly, yet. I think the entire idea they are based on should be slightly different. git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@111 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
fa648c717d
commit
8648fbb120
@ -41,7 +41,7 @@
|
||||
<CursorPos X="33" Y="12"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="167"/>
|
||||
<UsageCount Value="169"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -173,7 +173,7 @@
|
||||
<CursorPos X="10" Y="11"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="12"/>
|
||||
<UsageCount Value="133"/>
|
||||
<UsageCount Value="135"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
@ -305,17 +305,17 @@
|
||||
<CursorPos X="39" Y="8"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="132"/>
|
||||
<UsageCount Value="134"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit37>
|
||||
<Unit38>
|
||||
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="MufasaTypes"/>
|
||||
<CursorPos X="38" Y="32"/>
|
||||
<TopLine Value="11"/>
|
||||
<CursorPos X="51" Y="37"/>
|
||||
<TopLine Value="39"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="132"/>
|
||||
<UsageCount Value="134"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit38>
|
||||
<Unit39>
|
||||
@ -331,16 +331,16 @@
|
||||
<UnitName Value="files"/>
|
||||
<CursorPos X="15" Y="76"/>
|
||||
<TopLine Value="47"/>
|
||||
<UsageCount Value="133"/>
|
||||
<UsageCount Value="135"/>
|
||||
</Unit40>
|
||||
<Unit41>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Window"/>
|
||||
<CursorPos X="4" Y="228"/>
|
||||
<CursorPos X="57" Y="250"/>
|
||||
<TopLine Value="228"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="132"/>
|
||||
<UsageCount Value="134"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit41>
|
||||
<Unit42>
|
||||
@ -377,7 +377,7 @@
|
||||
<UnitName Value="finder"/>
|
||||
<CursorPos X="79" Y="29"/>
|
||||
<TopLine Value="15"/>
|
||||
<UsageCount Value="125"/>
|
||||
<UsageCount Value="127"/>
|
||||
</Unit46>
|
||||
<Unit47>
|
||||
<Filename Value="../../../lazarus/lcl/graphics.pp"/>
|
||||
@ -392,7 +392,7 @@
|
||||
<UnitName Value="MMLThread"/>
|
||||
<CursorPos X="10" Y="62"/>
|
||||
<TopLine Value="50"/>
|
||||
<UsageCount Value="123"/>
|
||||
<UsageCount Value="125"/>
|
||||
</Unit48>
|
||||
<Unit49>
|
||||
<Filename Value="../../../Documents/fpc/rtl/objpas/classes/classesh.inc"/>
|
||||
@ -407,7 +407,7 @@
|
||||
<CursorPos X="34" Y="114"/>
|
||||
<TopLine Value="101"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="121"/>
|
||||
<UsageCount Value="123"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit50>
|
||||
<Unit51>
|
||||
@ -518,7 +518,7 @@
|
||||
<CursorPos X="60" Y="12"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="34"/>
|
||||
<UsageCount Value="35"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit66>
|
||||
<Unit67>
|
||||
@ -539,7 +539,7 @@
|
||||
<UnitName Value="bitmaps"/>
|
||||
<CursorPos X="31" Y="430"/>
|
||||
<TopLine Value="419"/>
|
||||
<UsageCount Value="111"/>
|
||||
<UsageCount Value="113"/>
|
||||
</Unit69>
|
||||
<Unit70>
|
||||
<Filename Value="../../../FPC/FPCCheckout/packages/fcl-image/src/fpcanvas.pp"/>
|
||||
@ -559,7 +559,7 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="11" Y="61"/>
|
||||
<TopLine Value="65"/>
|
||||
<UsageCount Value="110"/>
|
||||
<UsageCount Value="112"/>
|
||||
</Unit72>
|
||||
<Unit73>
|
||||
<Filename Value="../../../FPC/FPCCheckout/packages/fcl-image/src/fpcanvas.inc"/>
|
||||
@ -691,7 +691,7 @@
|
||||
<UnitName Value="colour_conv"/>
|
||||
<CursorPos X="11" Y="148"/>
|
||||
<TopLine Value="140"/>
|
||||
<UsageCount Value="93"/>
|
||||
<UsageCount Value="95"/>
|
||||
</Unit92>
|
||||
<Unit93>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compcolors.pas"/>
|
||||
@ -750,7 +750,7 @@
|
||||
<UnitName Value="plugins"/>
|
||||
<CursorPos X="86" Y="128"/>
|
||||
<TopLine Value="128"/>
|
||||
<UsageCount Value="87"/>
|
||||
<UsageCount Value="89"/>
|
||||
</Unit101>
|
||||
<Unit102>
|
||||
<Filename Value="../../../Compilertje/Units/CogatUnits/compfiles.pas"/>
|
||||
@ -835,17 +835,17 @@
|
||||
<CursorPos X="9" Y="79"/>
|
||||
<TopLine Value="61"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="23"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit114>
|
||||
<Unit115>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="dtm"/>
|
||||
<CursorPos X="3" Y="399"/>
|
||||
<TopLine Value="387"/>
|
||||
<CursorPos X="31" Y="235"/>
|
||||
<TopLine Value="226"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="68"/>
|
||||
<UsageCount Value="70"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit115>
|
||||
<Unit116>
|
||||
@ -862,7 +862,7 @@
|
||||
<CursorPos X="53" Y="33"/>
|
||||
<TopLine Value="15"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<UsageCount Value="64"/>
|
||||
<UsageCount Value="66"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit117>
|
||||
<Unit118>
|
||||
@ -888,7 +888,7 @@
|
||||
<UnitName Value="windowselector"/>
|
||||
<CursorPos X="76" Y="83"/>
|
||||
<TopLine Value="65"/>
|
||||
<UsageCount Value="54"/>
|
||||
<UsageCount Value="56"/>
|
||||
</Unit120>
|
||||
<Unit121>
|
||||
<Filename Value="../../../../../../usr/lib64/fpc/2.2.4/source/rtl/objpas/classes/classesh.inc"/>
|
||||
@ -923,7 +923,7 @@
|
||||
<CursorPos X="1" Y="13"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="41"/>
|
||||
<UsageCount Value="43"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit125>
|
||||
<Unit126>
|
||||
@ -938,7 +938,7 @@
|
||||
<CursorPos X="2" Y="23"/>
|
||||
<TopLine Value="6"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<UsageCount Value="18"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit127>
|
||||
<Unit128>
|
||||
@ -969,7 +969,7 @@
|
||||
<CursorPos X="35" Y="45"/>
|
||||
<TopLine Value="14"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="21"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit131>
|
||||
<Unit132>
|
||||
@ -982,124 +982,124 @@
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
|
||||
<Caret Line="18" Column="30" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="89" Column="25" TopLine="74"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compdtm.pas"/>
|
||||
<Caret Line="61" Column="24" TopLine="41"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="228" Column="81" TopLine="224"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="8" Column="27" TopLine="1"/>
|
||||
<Caret Line="80" Column="60" TopLine="74"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="49" Column="5" TopLine="31"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="8" Column="66" TopLine="1"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
|
||||
<Caret Line="63" Column="30" TopLine="48"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="389" Column="16" TopLine="374"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="672" Column="16" TopLine="306"/>
|
||||
<Caret Line="21" Column="28" TopLine="21"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="792" Column="34" TopLine="788"/>
|
||||
<Caret Line="26" Column="28" TopLine="21"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="718" Column="4" TopLine="695"/>
|
||||
<Caret Line="32" Column="30" TopLine="21"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compdtm.pas"/>
|
||||
<Caret Line="79" Column="9" TopLine="61"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="37" Column="29" TopLine="21"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="629" Column="32" TopLine="594"/>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<Caret Line="13" Column="42" TopLine="1"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="89" Column="25" TopLine="74"/>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<Caret Line="32" Column="36" TopLine="11"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="228" Column="81" TopLine="224"/>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<Caret Line="23" Column="50" TopLine="1"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="80" Column="60" TopLine="74"/>
|
||||
<Caret Line="26" Column="1" TopLine="8"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="8" Column="66" TopLine="1"/>
|
||||
<Caret Line="24" Column="41" TopLine="9"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="389" Column="16" TopLine="374"/>
|
||||
<Caret Line="33" Column="37" TopLine="18"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="21" Column="28" TopLine="21"/>
|
||||
<Caret Line="21" Column="32" TopLine="6"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="26" Column="28" TopLine="21"/>
|
||||
<Caret Line="439" Column="31" TopLine="418"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="32" Column="30" TopLine="21"/>
|
||||
<Caret Line="422" Column="47" TopLine="418"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="37" Column="29" TopLine="21"/>
|
||||
<Caret Line="447" Column="34" TopLine="425"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<Caret Line="13" Column="42" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="393" Column="3" TopLine="380"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<Caret Line="32" Column="36" TopLine="11"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="451" Column="43" TopLine="434"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<Caret Line="23" Column="50" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="8" Column="28" TopLine="1"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="26" Column="1" TopLine="8"/>
|
||||
<Caret Line="676" Column="43" TopLine="661"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="24" Column="41" TopLine="9"/>
|
||||
<Caret Line="675" Column="29" TopLine="651"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="33" Column="37" TopLine="18"/>
|
||||
<Caret Line="251" Column="20" TopLine="232"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="21" Column="32" TopLine="6"/>
|
||||
<Caret Line="236" Column="38" TopLine="217"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="439" Column="31" TopLine="418"/>
|
||||
<Caret Line="643" Column="19" TopLine="630"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="422" Column="47" TopLine="418"/>
|
||||
<Caret Line="700" Column="23" TopLine="685"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="447" Column="34" TopLine="425"/>
|
||||
<Caret Line="233" Column="44" TopLine="217"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="393" Column="3" TopLine="380"/>
|
||||
<Caret Line="687" Column="30" TopLine="675"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -1,7 +1,7 @@
|
||||
object Form1: TForm1
|
||||
Left = 384
|
||||
Left = 1523
|
||||
Height = 553
|
||||
Top = 129
|
||||
Top = 172
|
||||
Width = 723
|
||||
ActiveControl = SynEdit1
|
||||
Caption = 'Mufasa v2'
|
||||
@ -25,7 +25,6 @@ object Form1: TForm1
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
BookMarkOptions.OnChange = nil
|
||||
Gutter.Width = 57
|
||||
Gutter.MouseActions = <
|
||||
item
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,18 +10,18 @@ const
|
||||
var
|
||||
ppdtm: pdtm;
|
||||
w,h,x,y,dtm,i: integer;
|
||||
|
||||
|
||||
a: extended;
|
||||
|
||||
p,pp: TPointArray;
|
||||
c,t,asz,ash: TIntegerArray;
|
||||
|
||||
begin
|
||||
p := [Point(0,0), Point(1,1)];
|
||||
c := [clWhite, clWhite];
|
||||
t := [0, 0];
|
||||
asz := [4, 4];
|
||||
ash := [dtm_Rectangle, dtm_Rectangle];
|
||||
p := [Point(0,0), Point(1,1), Point(-4, -4)];
|
||||
c := [clWhite, clWhite, clWhite];
|
||||
t := [0, 0, 0];
|
||||
asz := [0, 4, 4];
|
||||
ash := [dtm_Rectangle, dtm_Rectangle, dtm_Rectangle];
|
||||
setlength(ppdtm.p,2);
|
||||
setlength(ppdtm.c,2);
|
||||
setlength(ppdtm.t,2);
|
||||
@ -29,7 +29,7 @@ begin
|
||||
setlength(ppdtm.ash,2);
|
||||
|
||||
ppdtm.p := p;
|
||||
ppdtm.c := c;
|
||||
ppdtm.c := c;
|
||||
ppdtm.t := t;
|
||||
ppdtm.asz := asz;
|
||||
ppdtm.ash := ash;
|
||||
@ -37,6 +37,8 @@ begin
|
||||
dtm := AddpDTM(ppdtm);
|
||||
|
||||
getclientdimensions(w,h);
|
||||
writeln(inttostr(w) + ', ' + inttostr(h));
|
||||
|
||||
if FindDTM(dtm, x, y, 0, 0, w-1, h-1) then
|
||||
begin
|
||||
writeln('Found DTM at ' + inttostr(x) + ', ' + inttostr(y));
|
||||
@ -45,7 +47,7 @@ begin
|
||||
|
||||
if FindDTMs(dtm, p, 0, 0, w-1, h-1) then
|
||||
begin
|
||||
writeln('Found ' + inttostr(length(p)) + ' DTM(s). First one at ' +
|
||||
writeln('Found ' + inttostr(length(p)) + ' DTM(s). First one at ' +
|
||||
inttostr(p[0].x) + ', ' + inttostr(p[0].y));
|
||||
movemouse(p[0].x,p[0].y);
|
||||
end;
|
||||
@ -54,5 +56,5 @@ begin
|
||||
begin
|
||||
writeln('Found DTM at ' + inttostr(x) + ', ' + inttostr(y) + ' Angle: ' + FloatToStr(a));
|
||||
movemouse(x,y);
|
||||
end;
|
||||
end;
|
||||
end.
|
||||
|
@ -225,21 +225,6 @@ Begin
|
||||
Result := False;
|
||||
End;
|
||||
|
||||
function RotatePoints(P: TPointArray; A, cx, cy: Extended): TPointArray; inline;
|
||||
|
||||
var
|
||||
I, L: Integer;
|
||||
|
||||
begin
|
||||
L := High(P);
|
||||
SetLength(Result, L + 1);
|
||||
for I := 0 to L do
|
||||
begin
|
||||
Result[I].X := Round(cx + cos(A) * (p[i].x - cx) - sin(A) * (p[i].y - cy));
|
||||
Result[I].Y := Round(cy + sin(A) * (p[i].x - cx) + cos(A) * (p[i].y - cy));
|
||||
end;
|
||||
end;
|
||||
|
||||
{/\
|
||||
Rotates the given point (p) by A (in radians) around the point defined by cx, cy.
|
||||
/\}
|
||||
@ -382,6 +367,47 @@ begin
|
||||
FreeSpots[High(FreeSpots)] := DTM;
|
||||
end;
|
||||
|
||||
procedure DTMBounds(dtm: pDTM; var x1, y1, x2, y2: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
B: TBox;
|
||||
|
||||
begin
|
||||
for i := 0 to high(dtm.p) do
|
||||
begin
|
||||
B.X1 := Min(B.X1, dtm.p[i].X - dtm.asz[i]);
|
||||
B.Y1 := Min(B.Y1, dtm.p[i].Y - dtm.asz[i]);
|
||||
B.X2 := Max(B.X2, dtm.p[i].X + dtm.asz[i]);
|
||||
B.Y2 := Max(B.Y2, dtm.p[i].Y + dtm.asz[i]);
|
||||
end;
|
||||
writeln(inttostr(B.x1) + ', ' + inttostr(b.y1) + ', ' + inttostr(b.x2) +
|
||||
', ' + inttostr(b.y2));
|
||||
x1 += -B.X1;
|
||||
y1 += -B.Y1;
|
||||
X2 -= B.X2;
|
||||
Y2 -= B.Y2;
|
||||
end;
|
||||
|
||||
procedure DTMRotatedBounds(dtm: pDTM; var x1, y1, x2, y2: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
B: TBox;
|
||||
|
||||
begin
|
||||
for i := 0 to high(dtm.p) do
|
||||
begin
|
||||
B.X1 := Min(B.X1, dtm.p[i].X - dtm.asz[i]);
|
||||
B.Y1 := Min(B.Y1, dtm.p[i].Y - dtm.asz[i]);
|
||||
B.X2 := Max(B.X2, dtm.p[i].X + dtm.asz[i]);
|
||||
B.Y2 := Max(B.Y2, dtm.p[i].Y + dtm.asz[i]);
|
||||
end;
|
||||
writeln(inttostr(B.x1) + ', ' + inttostr(b.y1) + ', ' + inttostr(b.x2) +
|
||||
', ' + inttostr(b.y2));
|
||||
x1 += -B.X1 * 2;
|
||||
y1 += -B.Y1 * 2;
|
||||
X2 -= B.X2 * 2;
|
||||
Y2 -= B.Y2 * 2;
|
||||
end;
|
||||
{
|
||||
Tries to find the given DTM (index). If found will put the point the dtm has
|
||||
been found at in x, y and result to true.
|
||||
@ -412,24 +438,23 @@ var
|
||||
I, J, H, dH: Integer;
|
||||
Found: Boolean;
|
||||
TempTP: TPoint;
|
||||
MaxSubPointDist: TPoint;
|
||||
|
||||
|
||||
begin
|
||||
MaxSubPointDist := Point(0,0);
|
||||
|
||||
for I := 1 to High(DTM.p) do
|
||||
begin
|
||||
DTM.p[I].x := DTM.p[I].x - DTM.p[0].x;
|
||||
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
|
||||
MaxSubPointDist.X := Max(DTM.p[I].x, MaxSubPointDist.X);
|
||||
MaxSubPointDist.Y := Max(DTM.p[I].y, MaxSubPointDist.Y);
|
||||
|
||||
end;
|
||||
|
||||
X2 := X2 - MaxSubPointDist.X;
|
||||
Y2 := Y2 - MaxSubPointDist.Y;
|
||||
X1 := X1 + MaxSubPointDist.X;
|
||||
Y1 := Y1 + MaxSubPointDist.Y;
|
||||
{If X2 > X1 then
|
||||
writeln(inttostr(x1) + ', ' + inttostr(y1) + ', ' + inttostr(x2) +
|
||||
', ' + inttostr(y2));
|
||||
DTMBounds(DTM, x1, y1, x2, y2);
|
||||
writeln(inttostr(x1) + ', ' + inttostr(y1) + ', ' + inttostr(x2) +
|
||||
', ' + inttostr(y2));
|
||||
{If X2 > X1 then
|
||||
//Exit;
|
||||
If Y2 > Y1 then }
|
||||
//Exit;
|
||||
@ -509,11 +534,9 @@ Var
|
||||
I, J, H, dH: Integer;
|
||||
Found: Boolean;
|
||||
TempTP: TPoint;
|
||||
MaxSubPointDist: TPoint;
|
||||
|
||||
Begin
|
||||
Result := False;
|
||||
MaxSubPointDist := Point(0,0);
|
||||
SetLength(Points, 0);
|
||||
For I := 1 To High(DTM.p) Do
|
||||
Begin
|
||||
@ -521,10 +544,11 @@ Begin
|
||||
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
|
||||
End;
|
||||
|
||||
X2 := X2 - MaxSubPointDist.X;
|
||||
Y2 := Y2 - MaxSubPointDist.Y;
|
||||
X1 := X1 + MaxSubPointDist.X;
|
||||
Y1 := Y1 + MaxSubPointDist.Y;
|
||||
writeln(inttostr(x1) + ', ' + inttostr(y1) + ', ' + inttostr(x2) +
|
||||
', ' + inttostr(y2));
|
||||
DTMBounds(DTM, x1, y1, x2, y2);
|
||||
writeln(inttostr(x1) + ', ' + inttostr(y1) + ', ' + inttostr(x2) +
|
||||
', ' + inttostr(y2));
|
||||
{If X2 > X1 then
|
||||
//Exit;
|
||||
If Y2 > Y1 then }
|
||||
@ -608,17 +632,17 @@ Var
|
||||
MaxSubPointDist: TPoint;
|
||||
|
||||
Begin
|
||||
MaxSubPointDist := Point(0,0);
|
||||
For I := 1 To High(DTM.p) Do
|
||||
Begin
|
||||
DTM.p[I].x := DTM.p[I].x - DTM.p[0].x;
|
||||
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
|
||||
End;
|
||||
|
||||
X2 := X2 - MaxSubPointDist.X;
|
||||
Y2 := Y2 - MaxSubPointDist.Y;
|
||||
X1 := X1 + MaxSubPointDist.X;
|
||||
Y1 := Y1 + MaxSubPointDist.Y;
|
||||
writeln(inttostr(x1) + ', ' + inttostr(y1) + ', ' + inttostr(x2) +
|
||||
', ' + inttostr(y2));
|
||||
DTMRotatedBounds(DTM, x1, y1, x2, y2);
|
||||
writeln(inttostr(x1) + ', ' + inttostr(y1) + ', ' + inttostr(x2) +
|
||||
', ' + inttostr(y2));
|
||||
{If X2 > X1 then
|
||||
//Exit;
|
||||
If Y2 > Y1 then }
|
||||
@ -668,9 +692,13 @@ Begin
|
||||
|
||||
For R := 0 To High(Angle) Do
|
||||
Begin
|
||||
writeln('dtm: ' + inttostr(dtm.p[j].x) + ', ' + inttostr(dtm.p[j].y));
|
||||
writeln('mP: ' + inttostr(mP[i].x) + ', ' + inttostr(mP[i].y));
|
||||
TempTP.X := DTM.p[J].X + mP[I].X;
|
||||
TempTP.Y := DTM.p[J].Y + mP[I].Y;
|
||||
writeln('TempTP: ' + inttostr(TempTP.x) + ', ' + inttostr(TempTP.y));
|
||||
TempTP := RotatePoint(TempTP, Angle[R], mP[I].X, mP[I].Y);
|
||||
writeln('TempTP: ' + inttostr(TempTP.x) + ', ' + inttostr(TempTP.y));
|
||||
If Not AreaShape(DTM.c[J], DTM.t[J], DTM.asz[J], DTM.ash[J], TempTP) Then
|
||||
Begin
|
||||
For W := R To High(Angle) - 1 Do
|
||||
@ -741,20 +769,15 @@ Var
|
||||
tAngle: Extended;
|
||||
Found: Boolean;
|
||||
TempTP: TPoint;
|
||||
MaxSubPointDist: TPoint;
|
||||
|
||||
Begin
|
||||
MaxSubPointDist := Point(0,0);
|
||||
For I := 1 To High(DTM.p) Do
|
||||
Begin
|
||||
DTM.p[I].x := DTM.p[I].x - DTM.p[0].x;
|
||||
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
|
||||
End;
|
||||
|
||||
X2 := X2 - MaxSubPointDist.X;
|
||||
Y2 := Y2 - MaxSubPointDist.Y;
|
||||
X1 := X1 + MaxSubPointDist.X;
|
||||
Y1 := Y1 + MaxSubPointDist.Y;
|
||||
DTMBounds(DTM, x1, y1, x2, y2);
|
||||
{If X2 > X1 then
|
||||
//Exit;
|
||||
If Y2 > Y1 then }
|
||||
|
@ -37,6 +37,10 @@ type
|
||||
Possibly add .name too?
|
||||
Then one could give DTM names, which would be easy for debugging.
|
||||
}
|
||||
TBox = record
|
||||
x1, y1, x2, y2: Integer;
|
||||
end;
|
||||
|
||||
pDTM = record
|
||||
p: TPointArray;
|
||||
c, t, asz, ash: TIntegerArray;
|
||||
|
Loading…
Reference in New Issue
Block a user