Takes a Polygon object and simplifies the points by running them through a combination of Douglas-Peucker and Radial Distance algorithms. Simplification dramatically reduces the number of points in a polygon while retaining its shape, giving a huge performance boost when processing it and also reducing visual noise.
name | type | arguments | Default | description |
---|---|---|---|---|
polygon | Phaser.Geom.Polygon |
The polygon to be simplified. The polygon will be modified in-place and returned. |
||
tolerance | number | <optional> | 1 |
Affects the amount of simplification (in the same metric as the point coordinates). |
highestQuality | boolean | <optional> | false |
Excludes distance-based preprocessing step which leads to highest quality simplification but runs ~10-20 times slower. |
The input polygon.