Skip to content

Commit

Permalink
fix handling of degenerate thin data, close #51
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Jun 26, 2024
1 parent d3357ec commit cc66e38
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions polylabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ export default function polylabel(polygon, precision = 1.0, debug = false) {

const width = maxX - minX;
const height = maxY - minY;
const cellSize = Math.min(width, height);
let h = cellSize / 2;
const cellSize = Math.max(precision, Math.min(width, height));

if (cellSize === 0) {
if (cellSize === precision) {
const degeneratePoleOfInaccessibility = [minX, minY];
degeneratePoleOfInaccessibility.distance = 0;
return degeneratePoleOfInaccessibility;
Expand Down

0 comments on commit cc66e38

Please sign in to comment.