From 11aa611a58bbf4e1a9eeb4c5b749bd6f647507e5 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 13 Apr 2012 23:18:40 +0200 Subject: [PATCH] update manhattan grid example --- examples/manhattan_grid/js/example.js | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/manhattan_grid/js/example.js b/examples/manhattan_grid/js/example.js index 1e4c129d..e5e825db 100644 --- a/examples/manhattan_grid/js/example.js +++ b/examples/manhattan_grid/js/example.js @@ -8,7 +8,7 @@ Avenue A) and Zero St (a.k.a. Houston St). Avenues east of Zero Ave, just as Streets south of Zero St, have negative numbers. Broadway, which will split not only Manhattan but the entire globe into an eastern and a western hemisphere, retains its orientation, but is adjusted slightly so that it originates at the -intersection of Zero & Zero. From there, Broadway, Zero Ave and Zero Street +intersection of Zero & Zero. From there, Broadway, Zero Avenue and Zero Street continue as perfectly straight equatorial lines. All three will intersect once more, exactly halfway, in the Indian Ocean, (southwest of Australia), at the point furthest from Manhattan.

@@ -16,9 +16,9 @@ As subsequent avenues remain exactly parallel to Zero Ave, and subsequent streets exactly parallel to Zero St, they form smaller and smaller circles around the globe. The northernmost and southernmost streets are small circles in Central Asia (east of the Caspian Sea) and the southern Pacific (near Easter -Island), the westernmost and easternmost avenues are circles in the North +Island), the westernmost and easternmost avenues small circles in the North Pacific (west of Hawaii) and the South Atlantic (near St. Helena). These four -extreme points are the North Pole, South Pole, West Pole and East pole of the +extreme points are the North Pole, South Pole, West Pole and East Pole of the coordinate system. */ @@ -28,10 +28,9 @@ coordinate system. Include the Image module. */ Ox.load('Image', function() { - //'Etoile': {lat: 48.87377, lng: 2.29505} /* - Ox.EARTH_CIRCUMFERENCE (40075016.68557849) is a built-in constant + Ox.EARTH_CIRCUMFERENCE (40075016.68557849) is a built-in constant. */ var C = Ox.EARTH_CIRCUMFERENCE, /* @@ -58,8 +57,8 @@ Ox.load('Image', function() { Ox.getBearing returns the bearing, in degrees, from one lat/lng pair to another. To make sure that avenues and streets cross at an exact right angle, we first calculate the bearing of a line that cuts the upper - western quadrant of Columbus Circle in half, then subtract 45 degrees - for the direction of the avenues and add 45 degrees for the direction + western quadrant of Columbus Circle in half, then add 45 degrees for + the direction of the avenues and subtract 45 degrees for the direction of the streets. */ bearing = ( @@ -67,6 +66,7 @@ Ox.load('Image', function() { + Ox.getBearing(points['5 & 59'], points['8 & 59']) ) / 2 + 180, bearings = { + // fixme: Ox.mod ? avenues: (bearing + 45) % 360, streets: (bearing - 45) % 360 }, @@ -120,8 +120,8 @@ Ox.load('Image', function() { bearings.streets ); /* - The second intersection of 0th Ave, 0th St and Broadway is half of the - Earth's circumference away from the first one, in any direction. + The second intersection of Zero Avenue, Zero Street and Broadway is half of + the Earth's circumference away from the first one, in any direction. */ points['-0 & -0'] = Ox.getPoint( points['0 & 0'], @@ -130,12 +130,12 @@ Ox.load('Image', function() { ); /* Now that we have constructed the origin, we can calculate the bearing of - Broadway, which runs from 0th & 0th through Columbus Circle. + Broadway, which runs from Zero & Zero through Columbus Circle. */ bearings.broadway = Ox.getBearing(points['0 & 0'], points['8 & 59']), /* Also, we can construct the poles, each of which is a quarter of Earth's - circumference away from 0th & 0th. + circumference away from Zero & Zero. */ poles = { north: Ox.getPoint(points['0 & 0'], C / 4, bearings.avenues), @@ -161,8 +161,8 @@ Ox.load('Image', function() { /* Now we calculate circles for Broadway, Avenues and Streets. Ox.getCircle returns an array of lat/lng pairs that form a circle around a given point, - with a given radius and a given precision (the circle will have - Math.pow(2, precision) segments). + with a given radius and a given precision, so that the circle will have + Math.pow(2, precision) segments. */ lines = { /* @@ -232,7 +232,7 @@ Ox.load('Image', function() { /* getASByLatLng takes lat/lng and returns avenue/street. To compute the avenue, we subtract the point's distance from the West Pole, in - avenues, from the total number of avenues, to compute the street, we + avenues, from the total number of avenues. To compute the street, we subtract the point's distance from the North Pole, in avenues, from the total number of streets. We also return the bearing of the avenues at this point (which form a right angle with the line from the point to the West