Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Common shapes for your geo calculation needs
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.textile
Rakefile
VERSION
geo_shapes.gemspec

README.textile

Geo shapes

Geometrical shapes that can be used for various geo calculation purposes.

Status update

Work in progress…

Trying to refactor it to leverage geo- gems such as: geo_point, geo_vectors etc.

Usage

circle = Geo::Circle.new [10, 12], 5.km
circle = Geo::Circle.new :center => [10, 12], :radius => 5.km

rect = Geo::Rect.new [10, 12], [17, 18]
rect = Geo::Rect.new [10, 12], [4, -3].vector 

rect = Geo::Square.new [10, 12], 2.km
rect = Geo::Square.new :center => [10, 12], :radius => 2.km

rect.overlaps? point
rect.overlaps_any? *points
rect.overlaps_all? *points

# add vector to upper left point
rect.upper_left + [2, -1].vector

circle.random_points
circle.random_points(5)
  => [5 points]

rect.random_points(2)

Now also includes Radius functionality extracted from GeoMagic.

Contributing to geo_shapes

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2011 Kristian Mandrup. See LICENSE.txt for
further details.

Something went wrong with that request. Please try again.