I am trying to detect wether two MKOverlays (might be circles or polygons) intersect.
Tried using boundingMapRect but it draws a rectangle around my overlay thus giving me inaccurate results.
if polygon != nil {
intersectionOverlay = polygon!
} else {
intersectionOverlay = circle!
}
for overlay: MKOverlay in mapView.overlays {
let rect = overlay.boundingMapRect
if rect.intersects(intersectionOverlay.boundingMapRect) {
print("Intersects \(overlay.title)")
}
Using that piece of code, would return true for the situation in the images below. Is there any other better way to achieve the desired results? Thanks