','\par',[rfReplaceAll, rfIgnoreCase]);
str := StringReplace(str,'','\par',[rfReplaceAll, rfIgnoreCase]);
str := StringReplace(str,'
','\par',[rfReplaceAll, rfIgnoreCase]);
str := StringReplace(str,'','\b ' ,[rfReplaceAll, rfIgnoreCase]);
str := StringReplace(str,'','\b0 ' ,[rfReplaceAll, rfIgnoreCase]);
end;
ok := false;
s := str;
repeat
p := pos('<',s);
if p > 0 then begin
sx := copy(s,p+1,Length(s)-p);
pe := pos('>',sx);
if pe > 0 then
s := copy(s,1,p-1)+''+copy(s,p+pe+1,length(s))
else ok := true;
end else ok := true;
until ok;
s := StringReplace(s,' ',' ',[rfReplaceAll, rfIgnoreCase]);
s := StringReplace(s,' ',' ',[rfReplaceAll, rfIgnoreCase]);
s := Trim(s);
result := s;
chars.Free; // Tolik 21/05/2018 --
end;
Function RemoveBlocks(str:String; s1,s2: String):String;
var p,pe: Integer;
s: string;
ok: boolean;
sx: string;
begin
s1 := trim(s1);
s2 := trim(s2);
if (s1 = '') and (s2 = '') then
begin
result := str;
end else if (s1 = '') then begin
result := StringReplace(str,s2,'',[rfReplaceAll, rfIgnoreCase]);
end else if (s2 = '') then begin
result := StringReplace(str,s1,'',[rfReplaceAll, rfIgnoreCase]);
end else if (s1=s2) then begin
result := StringReplace(str,s1,'',[rfReplaceAll, rfIgnoreCase]);
end else begin
ok := false;
s := str;
repeat
p := Pos(lowercase(s1),lowercase(s));
if p > 0 then begin
sx := Copy(s,p+Length(s1),Length(s));
pe := pos(lowercase(s2),lowercase(sx));
if pe > 0 then begin
pe := pe+p+length(s1)-1;
s := copy(s,1,p-1)+' '+copy(s,pe+length(s2),length(s));
end else ok := true;
end else ok := true;
until ok;
result := s;
end;
end;
function GetAreaFromPolygon(APolygon: TDoublePointArr): Double;
var
i, j: Integer;
HighP: Integer;
begin
Result := 0;
HighP := High(APolygon);
for i := Low(APolygon) to HighP do
begin
if i = HighP then
j := 0
else
j := i+1;
Result := Result + ((APolygon[i].x * APolygon[j].y) - (APolygon[j].x * APolygon[i].y));
end;
Result := abs(Result) / 2;
end;
function GetLineLength3D(p1, p2: T3DPoint): Double;
begin
Result := sqrt(sqr(p2.x - p1.x)+sqr(p2.y - p1.y)+sqr(p2.z - p1.z));
end;
function GetTriangleArea3D(p1, p2, p3: T3DPoint): Double;
var
len1, len2, len3: Double;
p: Double;
begin
Result := 0;
len1 := GetLineLength3D(p1, p2);
len2 := GetLineLength3D(p2, p3);
len3 := GetLineLength3D(p3, p1);
p := (len1 + len2 + len3) / 2;
Result := SQRT(p*(p-len1) * (p-len2) * (p-len3));
end;
function IsPointNear(APointX, ApointY, ANearX, ANearY: Double): Boolean;
var
pdim : Double;
begin
end;
procedure DeletePointFromArray(var Arr: TDoublePointArr; Index: Integer);
begin
if Index < Length(Arr) then
begin
System.Move(Arr[Index + 1], Arr[Index],
(Length(Arr) - Index) * SizeOf(TDoublePoint));
SetLength(Arr, Length(Arr)-1);
end;
end;
initialization
{$ifdef demo}
if not delphiloaded then application.terminate;
{$endif demo}
figureclasses := TList.create;
FigureClassesSL := TStringList.Create; //01.11.2011
FigureClassesSL.Sorted := true;
OsVersion.dwOSVersionInfoSize := SizeOf(OSVersion);
getVersionEx(OSVersion);
TextureBmp := Graphics.TBitmap.Create;
TextureBmp.LoadFromResourceName(hInstance, 'textures');
Randomize;
finalization
figureclasses.free;
FigureClassesSL.Free; //01.11.2011
TextureBmp.Free;
end.