Class: Mindee::Geometry::Polygon
- Inherits:
-
Array
- Object
- Array
- Mindee::Geometry::Polygon
- Defined in:
- lib/mindee/geometry/polygon.rb
Overview
Contains any number of vertex coordinates (Points).
Instance Method Summary collapse
-
#centroid ⇒ Mindee::Geometry::Point
Get the central point (centroid) of the polygon.
-
#point_in_y?(point) ⇒ bool
Determine if the Point is in the Polygon’s Y-axis.
Instance Method Details
#centroid ⇒ Mindee::Geometry::Point
Get the central point (centroid) of the polygon.
10 11 12 |
# File 'lib/mindee/geometry/polygon.rb', line 10 def centroid Geometry.get_centroid(self) end |
#point_in_y?(point) ⇒ bool
Determine if the Point is in the Polygon’s Y-axis.
17 18 19 20 |
# File 'lib/mindee/geometry/polygon.rb', line 17 def point_in_y?(point) min_max = Geometry.get_min_max_y(self) point.y.between?(min_max.min, min_max.max) end |