ScratchData LogoScratchData
Back to DadOfMrLog's profile

Shortest Trip on Earth!

DADadOfMrLog•Created September 20, 2013
Shortest Trip on Earth!
179
129
3972 views
View on Scratch

Instructions

A quick project in response to a forum post: http://scratch.mit.edu/discuss/topic/16163/ It was a fun little maths problem, so I thought I'd have a go at it :) As you drag the dots, the orange line shows the shortest route on the surface of the Earth between the two dots. Slight anomalies as path crosses poles are not entirely unexpected... READ NOTES below to find out how it works!

Description

UPDATE: Shows approximate distance (uses mean earth radius) -apologies if distance/position displays cover your home... ;) === METHODOLOGY === A couple of centuries ago, spherical trigonometry was considered one of the most important topics to teach - in order to maintain naval superiority. However, the way this project works out routes is rather unusual, shunning such techniques. The idea is outlined in the forum post I made in response to the original question (link above). But essentially what it does is as follows: 1) work out the location of the two dots in 3d (Euclidean) space, as if on the surface of a unit sphere; 2) find the midpoint (will be within the sphere), and project that midpoint onto the surface of the unit sphere; 3) there are now three points on the surface, and we can carry on finding midpoints between adjacent points, and projecting onto the surface, until the distance between points is close enough for the lines joining them to be a good approximation to the required route around the unit sphere; 4) these 3d points are then transformed into lat/long, and projected onto the 2d map - the distance is calculated by using the length of the line-segments (should be all the same, since all from bisection), multiplied by how many segments there are, and then by the mean radius of the earth. SEE INSIDE for more - the code is commented fairly well... === MORE INFO === The picture of Earth is an equirectangular projection (in each of N-S and E-W), which means that a fixed difference in latitude gives the same vertical distance no matter where it is. Similarly for longitude. That's why the horizontal/vertical lines (15º apart) have the same distance between them on-screen - and it makes the calculation from screen co-ords to lat/long (and back) rather simple... :) The resolution shown for the dots' lat/long is only one degree. Of course, the Earth isn't exactly spherical -it's a bit squashed, so the distance from pole to pole is a few miles less than the distance across. This means the calculated route is also not totally exact - but it's all a reasonable approximation to give the idea...

Project Details

Project ID12540102
CreatedSeptember 20, 2013
Last ModifiedOctober 29, 2013
SharedSeptember 20, 2013
Visibilityvisible
CommentsAllowed