Class: Geometry::PointInPolygon
- Inherits:
-
Struct
- Object
- Struct
- Geometry::PointInPolygon
- Extended by:
- Memoist
- Defined in:
- lib/geometry/algorithms/point_in_polygon.rb
Instance Attribute Summary collapse
-
#point ⇒ Object
Returns the value of attribute point.
-
#polygon ⇒ Object
Returns the value of attribute polygon.
Instance Method Summary collapse
Instance Attribute Details
#point ⇒ Object
Returns the value of attribute point
2 3 4 |
# File 'lib/geometry/algorithms/point_in_polygon.rb', line 2 def point @point end |
#polygon ⇒ Object
Returns the value of attribute polygon
2 3 4 |
# File 'lib/geometry/algorithms/point_in_polygon.rb', line 2 def polygon @polygon end |
Instance Method Details
#inside? ⇒ Boolean
5 6 7 |
# File 'lib/geometry/algorithms/point_in_polygon.rb', line 5 def inside? point_location == :inside end |
#on_the_boundary? ⇒ Boolean
13 14 15 |
# File 'lib/geometry/algorithms/point_in_polygon.rb', line 13 def on_the_boundary? point_location == :on_the_boundary end |
#outside? ⇒ Boolean
9 10 11 |
# File 'lib/geometry/algorithms/point_in_polygon.rb', line 9 def outside? point_location == :outside end |
#point_location ⇒ Object
17 18 19 20 21 22 |
# File 'lib/geometry/algorithms/point_in_polygon.rb', line 17 def point_location return :outside unless bounding_box.contains?(point) return :on_the_boundary if point_is_vertex? || point_on_edge? intersection_count(choose_good_ray).odd? ? :inside : :outside end |