Class: GeometricPointInPolygon
- Inherits:
-
Struct
- Object
- Struct
- GeometricPointInPolygon
- Extended by:
- Memoist
- Defined in:
- lib/flash_math/modules/geometry/geometric_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
1 2 3 |
# File 'lib/flash_math/modules/geometry/geometric_point_in_polygon.rb', line 1 def point @point end |
#polygon ⇒ Object
Returns the value of attribute polygon
1 2 3 |
# File 'lib/flash_math/modules/geometry/geometric_point_in_polygon.rb', line 1 def polygon @polygon end |
Instance Method Details
#inside? ⇒ Boolean
4 5 6 |
# File 'lib/flash_math/modules/geometry/geometric_point_in_polygon.rb', line 4 def inside? point_location == :inside end |
#on_the_boundary? ⇒ Boolean
12 13 14 |
# File 'lib/flash_math/modules/geometry/geometric_point_in_polygon.rb', line 12 def on_the_boundary? point_location == :on_the_boundary end |
#outside? ⇒ Boolean
8 9 10 |
# File 'lib/flash_math/modules/geometry/geometric_point_in_polygon.rb', line 8 def outside? point_location == :outside end |
#point_location ⇒ Object
16 17 18 19 20 21 |
# File 'lib/flash_math/modules/geometry/geometric_point_in_polygon.rb', line 16 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 |