mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-27 11:32:18 -05:00
commit
da0de6e4b9
@ -44,7 +44,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="48">
|
<Units Count="50">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="Simba.lpr"/>
|
<Filename Value="Simba.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -304,6 +304,15 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="os_linux"/>
|
<UnitName Value="os_linux"/>
|
||||||
</Unit47>
|
</Unit47>
|
||||||
|
<Unit48>
|
||||||
|
<Filename Value="../../Units/MMLCore/tpa.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="tpa"/>
|
||||||
|
</Unit48>
|
||||||
|
<Unit49>
|
||||||
|
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit49>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -33,7 +33,7 @@ uses
|
|||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, Forms, SimbaUnit, colourhistory, About, internets, debugimage,
|
Interfaces, Forms, SimbaUnit, colourhistory, About, internets, debugimage,
|
||||||
framefunctionlist, simpleanalyzer, updater, updateform, Simbasettings,
|
framefunctionlist, simpleanalyzer, updater, updateform, Simbasettings,
|
||||||
libloader, mufasabase, v_ideCodeInsight,
|
libloader, mufasabase, tpa, v_ideCodeInsight,
|
||||||
PSDump, v_ideCodeParser,
|
PSDump, v_ideCodeParser,
|
||||||
v_AutoCompleteForm, CastaliaPasLex, CastaliaPasLexTypes, CastaliaSimplePasPar,
|
v_AutoCompleteForm, CastaliaPasLex, CastaliaPasLexTypes, CastaliaSimplePasPar,
|
||||||
CastaliaSimplePasParTypes, dcpbase64, mPasLex, v_Constants, v_MiscFunctions,
|
CastaliaSimplePasParTypes, dcpbase64, mPasLex, v_Constants, v_MiscFunctions,
|
||||||
|
Binary file not shown.
@ -143,6 +143,11 @@ begin
|
|||||||
FilterPointsLine(points,radial,radius,mx,my);
|
FilterPointsLine(points,radial,radius,mx,my);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ps_FilterTPADist(var TPA: TPointArray; maxDist: integer);
|
||||||
|
begin
|
||||||
|
FilterTPADist(TPA, maxDist);
|
||||||
|
end;
|
||||||
|
|
||||||
function ps_GetATPABounds(const ATPA: T2DPointArray): TBox;extdecl;
|
function ps_GetATPABounds(const ATPA: T2DPointArray): TBox;extdecl;
|
||||||
begin
|
begin
|
||||||
result := GetATPABounds(ATPA);
|
result := GetATPABounds(ATPA);
|
||||||
|
@ -458,6 +458,7 @@ AddFunction(@ps_FloodFillTPA,'function FloodFillTPA(const TPA : TPointArray) : T
|
|||||||
AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);');
|
AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);');
|
||||||
AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);');
|
AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);');
|
||||||
AddFunction(@ps_filterpointsdist,'procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);');
|
AddFunction(@ps_filterpointsdist,'procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);');
|
||||||
|
AddFunction(@ps_filterTPADist, 'procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);');
|
||||||
AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;');
|
AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;');
|
||||||
AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;');
|
AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;');
|
||||||
AddFunction(@ps_FindTPAinTPA,'function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;');
|
AddFunction(@ps_FindTPAinTPA,'function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;');
|
||||||
|
@ -67,6 +67,7 @@ function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;
|
|||||||
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
|
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
|
||||||
procedure FilterPointsDist(var Points: TPointArray; const MinDist,MaxDist: Extended; Mx, My: Integer);
|
procedure FilterPointsDist(var Points: TPointArray; const MinDist,MaxDist: Extended; Mx, My: Integer);
|
||||||
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
|
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
|
||||||
|
procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);
|
||||||
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
|
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
|
||||||
function GetATPABounds(const ATPA: T2DPointArray): TBox;
|
function GetATPABounds(const ATPA: T2DPointArray): TBox;
|
||||||
function GetTPABounds(const TPA: TPointArray): TBox;
|
function GetTPABounds(const TPA: TPointArray): TBox;
|
||||||
@ -1168,6 +1169,55 @@ begin
|
|||||||
Points:= P;
|
Points:= P;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{/\
|
||||||
|
Removes points in the TPA that are within maxDist of each other.
|
||||||
|
/\}
|
||||||
|
procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);
|
||||||
|
var
|
||||||
|
c, i, j, l, h, maxDistSq: integer;
|
||||||
|
newTPA: TPointArray;
|
||||||
|
inBadElements: TBooleanArray;
|
||||||
|
begin
|
||||||
|
h := high(TPA);
|
||||||
|
l := (h + 1);
|
||||||
|
maxDistSq := (maxDist * maxDist);
|
||||||
|
|
||||||
|
setLength(inBadElements, l);
|
||||||
|
setLength(newTPA, l);
|
||||||
|
|
||||||
|
for i := 0 to h do
|
||||||
|
inBadElements[i] := false;
|
||||||
|
|
||||||
|
for i := 0 to (h - 1) do
|
||||||
|
begin
|
||||||
|
if (inBadElements[i]) then
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for j := (i + 1) to h do
|
||||||
|
begin
|
||||||
|
if (inBadElements[j]) then
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// simplified -> a^2 + b^2 <= c^2
|
||||||
|
if (((TPA[i].x - TPA[j].x) * (TPA[i].x - TPA[j].x)) + ((TPA[i].y - TPA[j].y) * (TPA[i].y - TPA[j].y)) <= maxDistSq) then
|
||||||
|
inBadElements[j] := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
c := 0;
|
||||||
|
|
||||||
|
// set the new TPA
|
||||||
|
for i := 0 to h do
|
||||||
|
if (not inBadElements[i]) then
|
||||||
|
begin
|
||||||
|
newTPA[c] := TPA[i];
|
||||||
|
inc(c);
|
||||||
|
end;
|
||||||
|
|
||||||
|
setLength(newTPA, c);
|
||||||
|
TPA := newTPA;
|
||||||
|
end;
|
||||||
|
|
||||||
{/\
|
{/\
|
||||||
Removes the points that are inside or outside the distance Dist from the point (x, y) from the TPointArray ThePoints.
|
Removes the points that are inside or outside the distance Dist from the point (x, y) from the TPointArray ThePoints.
|
||||||
/\}
|
/\}
|
||||||
|
Loading…
Reference in New Issue
Block a user