Class: Bounds
- Inherits:
-
Struct
- Object
- Struct
- Bounds
- Defined in:
- lib/contrek/finder/bounds.rb
Instance Attribute Summary collapse
-
#max_x ⇒ Object
Returns the value of attribute max_x.
-
#max_y ⇒ Object
Returns the value of attribute max_y.
-
#min_x ⇒ Object
Returns the value of attribute min_x.
-
#min_y ⇒ Object
Returns the value of attribute min_y.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#max_x ⇒ Object
Returns the value of attribute max_x
1 2 3 |
# File 'lib/contrek/finder/bounds.rb', line 1 def max_x @max_x end |
#max_y ⇒ Object
Returns the value of attribute max_y
1 2 3 |
# File 'lib/contrek/finder/bounds.rb', line 1 def max_y @max_y end |
#min_x ⇒ Object
Returns the value of attribute min_x
1 2 3 |
# File 'lib/contrek/finder/bounds.rb', line 1 def min_x @min_x end |
#min_y ⇒ Object
Returns the value of attribute min_y
1 2 3 |
# File 'lib/contrek/finder/bounds.rb', line 1 def min_y @min_y end |
Class Method Details
.empty ⇒ Object
2 3 4 |
# File 'lib/contrek/finder/bounds.rb', line 2 def self.empty new(Float::INFINITY, -Float::INFINITY, Float::INFINITY, -Float::INFINITY) end |
Instance Method Details
#empty? ⇒ Boolean
14 15 16 |
# File 'lib/contrek/finder/bounds.rb', line 14 def empty? min_x == Float::INFINITY end |
#expand(x:, y:) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/contrek/finder/bounds.rb', line 6 def (x:, y:) self.min_x = x if x < min_x self.max_x = x if x > max_x self.min_y = y if y < min_y self.max_y = y if y > max_y self end |