- Timestamp:
- Sep 19, 2018, 2:34:06 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGeometry.pas
r192 r232 97 97 function GetRect: TGRect<T>; 98 98 function EdgeDistance(Polygon: TGPolygon<T>): Double; 99 function GetCenter: T; 99 100 procedure AddPoint(const P: T); 100 101 procedure Clear; … … 164 165 begin 165 166 Result := Points[Index]; 167 end; 168 169 function TGPolygon<T>.GetCenter: T; 170 var 171 I: Integer; 172 begin 173 Result := T.Create(0, 0); 174 for I := 0 to Length(Points) - 1 do 175 Result := Result + Points[I]; 176 Result.X := TypedRound(Result.X / Length(Points)); 177 Result.Y := TypedRound(Result.Y / Length(Points)); 166 178 end; 167 179 -
trunk/UMapType.pas
r231 r232 405 405 end; 406 406 407 // Adjust polygon centers 408 for I := 0 to Cells.Count - 1 do begin 409 Cells[I].PosPx := Cells[I].Polygon.GetCenter; 410 end; 411 407 412 FPixelRect := CalculatePixelRect; 408 413 end;
Note:
See TracChangeset
for help on using the changeset viewer.