Re: [android-developers] Need some math assistance please
in iOS the manual function is faster than the built-in one, but on Android the difference is negligible. here's the Objective-C version
//spherical distance in meters
- (CGFloat) sphericalDistanceFromLat1:(CGFloat)lat1 Lon1:(CGFloat)lon1 toLat2:(CGFloat)lat2 Lon2:(CGFloat)lon2 {
return acos(sin(lat1 * 0.0174533) * sin(lat2 * 0.0174533) + cos(lat1 * 0.0174533) * cos(lat2 * 0.0174533) * cos((lon2-lon1) * 0.0174533)) * 6371000;
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home