Class: GeometricBoundingBox
- Inherits:
-
Struct
- Object
- Struct
- GeometricBoundingBox
- Defined in:
- lib/flash_math/modules/geometry/geometric_bounding_box.rb
Instance Attribute Summary collapse
-
#leftbottom ⇒ Object
Returns the value of attribute leftbottom.
-
#righttop ⇒ Object
Returns the value of attribute righttop.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#leftbottom ⇒ Object
Returns the value of attribute leftbottom
1 2 3 |
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 1 def leftbottom @leftbottom end |
#righttop ⇒ Object
Returns the value of attribute righttop
1 2 3 |
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 1 def righttop @righttop end |
Class Method Details
.new_by_arrays(point1_coordinates, point2_coordinates) ⇒ Object
3 4 5 6 |
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 3 def self.new_by_arrays(point1_coordinates, point2_coordinates) self.new(GeometricPoint.new_by_array(point1_coordinates), GeometricPoint.new_by_array(point2_coordinates)) end |
Instance Method Details
#contains?(point) ⇒ Boolean
12 13 14 |
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 12 def contains?(point) point.x.between?(leftbottom.x, righttop.x) && point.y.between?(leftbottom.y, righttop.y) end |
#diagonal ⇒ Object
8 9 10 |
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 8 def diagonal GeometricSegment.new(leftbottom, righttop) end |