Class: Geometry::BoundingBox
- Inherits:
-
Struct
- Object
- Struct
- Geometry::BoundingBox
- Defined in:
- lib/bounding_box.rb
Instance Attribute Summary collapse
-
#leftbottom ⇒ Object
Returns the value of attribute leftbottom.
-
#righttop ⇒ Object
Returns the value of attribute righttop.
Instance Method Summary collapse
Instance Attribute Details
#leftbottom ⇒ Object
Returns the value of attribute leftbottom
2 3 4 |
# File 'lib/bounding_box.rb', line 2 def leftbottom @leftbottom end |
#righttop ⇒ Object
Returns the value of attribute righttop
2 3 4 |
# File 'lib/bounding_box.rb', line 2 def righttop @righttop end |
Instance Method Details
#contains?(point) ⇒ Boolean
7 8 9 |
# File 'lib/bounding_box.rb', line 7 def contains?(point) point.x.between?(leftbottom.x, righttop.x) && point.y.between?(leftbottom.y, righttop.y) end |
#diagonal ⇒ Object
3 4 5 |
# File 'lib/bounding_box.rb', line 3 def diagonal Segment leftbottom, righttop end |