Created
August 12, 2014 06:32
-
-
Save sebastibe/6492d286afd91af7718b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given an array of coordinates, get the bounding box | |
getBounds = (coordinates) -> | |
xv = [] | |
yv = [] | |
$.each(coordinates, (i, coord) -> | |
xv.push(coord[0]) | |
yv.push(coord[1]) | |
) | |
return [ | |
[Math.min.apply(null, xv), Math.min.apply(null, yv)], | |
[Math.max.apply(null, xv), Math.max.apply(null, yv)] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment