Ignore:
Timestamp:
Nov 26, 2017, 11:35:25 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Improved generation of random mesh map to avoid overlapping cells polygons and removed links from non-neighboring cells.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UGeometry.pas

    r172 r174  
    9595    constructor Create(const Rect: TGRect<T>); overload;
    9696    function GetRect: TGRect<T>;
     97    function EdgeDistance(Polygon: TGPolygon<T>): Double;
    9798    procedure AddPoint(const P: T);
    9899    procedure Clear;
     
    157158end;
    158159
    159 { TPolygon }
     160{ TGPolygon }
    160161
    161162function TGPolygon<T>.GetPoint(const Index: Integer): T;
     
    282283end;
    283284
    284 { TLine }
     285function TGPolygon<T>.EdgeDistance(Polygon: TGPolygon<T>): Double;
     286var
     287  I, J: Integer;
     288  Dist: Double;
     289begin
     290  Result := Infinity;
     291  for I := 0 to Length(Points) - 1 do
     292  for J := 0 to Length(Polygon.Points) - 1 do begin
     293    Dist := TGLine<T>.Create(Points[I], Polygon.Points[J]).Distance;
     294    if Dist < Result then Result := Dist;
     295  end;
     296end;
     297
     298{ TGLine }
    285299
    286300function TGLine<T>.GetDistance: Double;
Note: See TracChangeset for help on using the changeset viewer.