use markdown
This commit is contained in:
parent
c831b89944
commit
9269b96469
4 changed files with 44 additions and 47 deletions
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
The idea (a slight variation of a proposal by
|
||||
<a href="http://extendny.com/">Harold Cooper</a>) is to extend the Manhattan
|
||||
Grid in all directions, so that every point on Earth can be addressed as
|
||||
"Xth Ave & Yth St".<br><br>
|
||||
The idea (a slight variation of a proposal by [Harold
|
||||
Cooper](http://extendny.com/)) is to extend the Manhattan Grid in all
|
||||
directions, so that every point on Earth can be addressed as "Xth Ave & Yth
|
||||
St".
|
||||
|
||||
The origin of this coordinate system is the intersection of Zero Ave (a.k.a.
|
||||
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
|
||||
|
|
@ -11,7 +12,8 @@ retains its orientation, but is adjusted slightly so that it originates at the
|
|||
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.<br><br>
|
||||
point furthest from Manhattan.
|
||||
|
||||
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
|
||||
|
|
@ -144,7 +146,7 @@ Ox.load('Image', function() {
|
|||
east: Ox.getPoint(points['0 & 0'], -C / 4, bearings.streets),
|
||||
/*
|
||||
Broadway has two poles as well, and constructing them will make drawing
|
||||
easier. Ox.mod is the modulo function. Unlike <code>-90 % 360</code>,
|
||||
easier. Ox.mod is the modulo function. Unlike `-90 % 360`,
|
||||
which in JavaScript is -90, Ox.mod(-90, 360) returns 270.
|
||||
*/
|
||||
westBroadway: Ox.getPoint(
|
||||
|
|
@ -162,7 +164,7 @@ 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, so that the circle will have
|
||||
<code>Math.pow(2, precision)</code> segments.
|
||||
`Math.pow(2, precision)` segments.
|
||||
*/
|
||||
lines = {
|
||||
/*
|
||||
|
|
@ -209,10 +211,10 @@ Ox.load('Image', function() {
|
|||
|
||||
/*
|
||||
Before we start drawing, we define a few helper functions.
|
||||
<code>getXYByLatLng</code> returns screen coordinates for a given point.
|
||||
`getXYByLatLng` returns screen coordinates for a given point.
|
||||
We use Ox.getXYByLatLng, which takes a lat/lng pair and returns its x/y
|
||||
position on a 1×1 Mercator position, with <code>{x: 0, y: 0}</code> at the
|
||||
bottom left and <code>{x: 1, y: 1}</code> at the top right.
|
||||
position on a 1×1 Mercator position, with `{x: 0, y: 0}` at the
|
||||
bottom left and `{x: 1, y: 1}` at the top right.
|
||||
*/
|
||||
function getXYByLatLng(point) {
|
||||
return Ox.map(Ox.getXYByLatLng(point), function(v) {
|
||||
|
|
@ -221,7 +223,7 @@ Ox.load('Image', function() {
|
|||
}
|
||||
|
||||
/*
|
||||
<code>getLatLngByXY</code> is the inverse of the above, just like
|
||||
`getLatLngByXY` is the inverse of the above, just like
|
||||
Ox.getLatLngByXY.
|
||||
*/
|
||||
function getLatLngByXY(xy) {
|
||||
|
|
@ -231,7 +233,7 @@ Ox.load('Image', function() {
|
|||
}
|
||||
|
||||
/*
|
||||
<code>getASByLatLng</code> takes lat/lng and returns avenue/street. To
|
||||
`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
|
||||
subtract the point's distance from the North Pole, in avenues, from the
|
||||
|
|
@ -260,7 +262,7 @@ Ox.load('Image', function() {
|
|||
}
|
||||
|
||||
/*
|
||||
<code>getASByXY</code> returns avenue and street at the given screen
|
||||
`getASByXY` returns avenue and street at the given screen
|
||||
coordinates.
|
||||
*/
|
||||
function getASByXY(xy) {
|
||||
|
|
@ -268,7 +270,7 @@ Ox.load('Image', function() {
|
|||
}
|
||||
|
||||
/*
|
||||
<code>drawPath</code> draws a path of lat/lng pairs on an image. For each
|
||||
`drawPath` draws a path of lat/lng pairs on an image. For each
|
||||
path segment, we have to check if it crosses the eastern or western edge of
|
||||
the map that splits the Pacific Ocean. Note that our test (a segment
|
||||
crosses the edge if it spans more than 180 degrees longitude) is obviously
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue