Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2012 21:56
Show Gist options
  • Save anonymous/1935517 to your computer and use it in GitHub Desktop.
Save anonymous/1935517 to your computer and use it in GitHub Desktop.
a guest on Feb 28th, 2012 - pastebin.com/1YXe6Nvd
for (var i = 0; i < mapPoints.length; i++){
for (var j = i + 1; j < mapPoints.length; j++){
var p1 = mapPoints[i];
var p2 = mapPoints[j];
if (getDistance(p1, p2) < 0.1){ // If distance between points is greater than .1 km
var midpoint = getMidpoint(p1, p2);
mapPoints.push(midpoint);
mapPoints.splice(i, 1);
mapPoints.splice(j, 1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment