Created
January 7, 2016 16:14
-
-
Save efwe/65e28c72c9948da0e9f8 to your computer and use it in GitHub Desktop.
This file contains 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
step = 0.1 # all points within 100 meters | |
points = [] | |
(1..500).each { |i| # for the next 50km | |
min_distance = ((i-1)*step)/EARTH_RADIUS | |
max_distance = (i*step)/EARTH_RADIUS | |
hull = hull_for min_distance, max_distance # calculate the convex hull for the points in this area | |
unless hull.empty? | |
#remap once more | |
hull.each { |p| | |
points << [p[1], p[0]] # remember points | |
} | |
end | |
if i%100==0 | |
Rails.logger.info "Finished "+(i/10).to_s+" km" | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment