Class: GeoMagic::Rectangle
- Inherits:
-
Object
- Object
- GeoMagic::Rectangle
- Defined in:
- lib/geo_magic/rectangle.rb
Instance Attribute Summary collapse
-
#bottom_right_point ⇒ Object
Returns the value of attribute bottom_right_point.
-
#top_left_point ⇒ Object
Returns the value of attribute top_left_point.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(point_a, point_b) ⇒ Rectangle
constructor
A new instance of Rectangle.
- #overlaps?(point) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(point_a, point_b) ⇒ Rectangle
Returns a new instance of Rectangle.
5 6 7 8 |
# File 'lib/geo_magic/rectangle.rb', line 5 def initialize point_a, point_b @top_left_point = GeoMagic::Point.new left_lat(point_a, point_b), bot_long(point_a, point_b) @bottom_right_point = GeoMagic::Point.new right_lat(point_a, point_b), top_long(point_a, point_b) end |
Instance Attribute Details
#bottom_right_point ⇒ Object
Returns the value of attribute bottom_right_point.
3 4 5 |
# File 'lib/geo_magic/rectangle.rb', line 3 def bottom_right_point @bottom_right_point end |
#top_left_point ⇒ Object
Returns the value of attribute top_left_point.
3 4 5 |
# File 'lib/geo_magic/rectangle.rb', line 3 def top_left_point @top_left_point end |
Class Method Details
Instance Method Details
#overlaps?(point) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/geo_magic/rectangle.rb', line 14 def overlaps? point # puts "inside_top_left?: #{point} -> #{inside_top_left?(point)}" # puts "inside_bottom_right?: #{point} -> #{inside_bottom_right?(point)}" inside_top_left?(point) && inside_bottom_right?(point) end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/geo_magic/rectangle.rb', line 20 def to_s "#{top_left_point} - #{bottom_right_point}" end |