mapbox / turf-swift

A Swift language port of Turf.js.
https://mapbox.github.io/turf-swift/
ISC License
236 stars 55 forks source link

Add property for self-intersections (kinks) in polygons #190

Open Sean12oshea opened 2 years ago

Sean12oshea commented 2 years ago

We have been working on trying to detect if a polygon intersects itself when a user is drawing a polygon on the map in realtime or after a user completes the polygon. We tried to implement our own method using multiple approaches with this being one of them but all seem to have false positives.

Is there a plan to port this over from Turf.js? Has anyone implemented this in the past where you didn't receive false positives?

1ec5 commented 2 years ago

Hi, your use case sounds interesting. I don’t think anyone is actively working on this function right now, but we’d welcome any contribution of a Swift implementation for it. In Swift, it would most naturally be a computed property like Polygon.selfIntersections, though it could live in a protocol shared by various geometry types to avoid duplication.