1

I have a iOS application, with a MapView with several MKPolygons positioned to represent buildings on the map. Using the compass and GPS I want to be able to work out which of the polygons the handset is being aimed at.

I already am getting the GPS location and using the magnetometer to get the heading so just need to work out how to project from this point and work out which polygon it hits first.

Any suggestion??

Mark Adams
  • 30,776
  • 11
  • 77
  • 77

1 Answers1

0

You probably want to look at some like collision detection in 3D games to solve this problem. Sounds like an identical problem to me. There is a good overview of the different algorithms for this in this stackoverflow question: When to use Binary Space Partitioning, Quadtree, Octree?

Community
  • 1
  • 1
Aaron
  • 2,403
  • 1
  • 24
  • 25