imajes/geokit-gem — pull request #52 by reidb (2012-03-13 21:28:39+00:00)
Title: Adding Geokit::Polygon class to mappable.rb

Creates a Polygon class, usage example:

p1 = Geokit::LatLng.new(45.3142533036254, -93.47527313511819)
p2 = Geokit::LatLng.new(45.31232182518015, -93.34893036168069)
p3 = Geokit::LatLng.new(45.23694281999268, -93.35167694371194)
p4 = Geokit::LatLng.new(45.23500870841669, -93.47801971714944)
p5 = Geokit::LatLng.new(45.3142533036254, -93.47527313511819)

points = [p1, p2, p3, p4, p5]
polygon = Geokit::Polygon.new(points)

point_inside = Geokit::LatLng.new(45.27428243796789, -93.41648483416066)
point_outside = Geokit::LatLng.new(45.45411010558687, -93.78151703160256)

polygon.contains?(point_inside) => true
polygon.contains?(point_outside) => false