This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
dlon = x2 - x1; dlat = y2 - y1; a = (Math.sin(dlat/2))2 Math.cos(lat1) * Math.cos(lat2) * (Math.sin(dlon/2))2; c = 2 * (aMath.tan(2)(Math.sqrt(a), Math.sqrt(1-a))); result = r * c;
I am writing a program to calculate the distance between two places in the world based on their longitude(x) and latitude(y). there is a formula for doing this and i am almost sucessful in rewriting it to work in java but i hit a bit of a problem. the comma in the second last line, im not sure how to rewrite this. any help would be great. if you need any extra info to solve this just ask.
I forgot to mention that r is the radius of the earth in km (6371)
Subreddit
Post Details
- Posted
- 11 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...