[ad_1]
I’m attempting to detect wether two MKOverlays (is likely to be circles or polygons) intersect.
Tried utilizing boundingMapRect nevertheless it attracts a rectangle round my overlay thus giving me inaccurate outcomes.
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)")
}
Utilizing that piece of code, would return true for the state of affairs within the pictures under. Is there some other higher method to obtain the specified outcomes? Thanks
[ad_2]


