Skip to content

Instantly share code, notes, and snippets.

@efwe
Created January 7, 2016 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efwe/65e28c72c9948da0e9f8 to your computer and use it in GitHub Desktop.
Save efwe/65e28c72c9948da0e9f8 to your computer and use it in GitHub Desktop.
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