Class: GeoRuby::SimpleFeatures::LinearRing
- Inherits:
-
LineString
- Object
- LineString
- GeoRuby::SimpleFeatures::LinearRing
- Defined in:
- lib/georuby-extras.rb
Instance Method Summary collapse
Instance Method Details
#fast_contains?(point) ⇒ Boolean
28 29 30 |
# File 'lib/georuby-extras.rb', line 28 def fast_contains?(point) !!PointInPoly.point_in_poly(point.x.to_f, point.y.to_f, points) end |
#slow_contains?(point_to_check) ⇒ Boolean
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/georuby-extras.rb', line 32 def slow_contains?(point_to_check) c = 0 last = points[points.length - 1] points.each do |point| if (point.y > point_to_check.y) != (last.y > point_to_check.y) c += 1 if point_to_check.x < (last.x - point.x) * (point_to_check.y - point.y) / (last.y / point.y) + point.x end last = point end ((c % 2) == 1) end |