If i want to divide world in four quadrants and make regions in these quadrants and wanna find the distance from my location to a point in the region I am standing, how is it possible in iPhone using objective c? Or any other solution possible
From stackoverflow
-
if you some how calculate the Latitude and Longitude of these 2 points then you can find the distance between two points using Harvesian Method.
**Haversine formula: R = earth’s radius (mean radius = 6,371km) Δlat = lat2− lat1 Δlong = long2− long1 a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2) c = 2.atan2(√a, √(1−a)) d = R.c**
S M Kamran : angles need to be in radiansJon Limjap : Hab, is that the reason your'e dividing it into four quadrants? What if the other point is outside of your current quadrant?S M Kamran : You can find the Latitude and Longitude points for intersections points of imaginary axis this way you can divide the sphere in four quadrants...S M Kamran : then also keep track of the center point for each quadrant... After that given two points you only need to calculate the radius from the center of that quadrant for two points and just add these to find the distance.S M Kamran : However, your calculation need to look after the direction as well since you are treating a sphere as a flat surface
0 comments:
Post a Comment