Class: Contrek::Concurrent::InnerPolyline
- Inherits:
-
Object
- Object
- Contrek::Concurrent::InnerPolyline
- Defined in:
- lib/contrek/finder/concurrent/inner_polyline.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#shape ⇒ Object
Returns the value of attribute shape.
-
#vertical_bounds ⇒ Object
readonly
Returns the value of attribute vertical_bounds.
Instance Method Summary collapse
- #compute_vertical_bounds! ⇒ Object
-
#initialize(shape: nil, raw_coordinates: [], sequence: nil) ⇒ InnerPolyline
constructor
A new instance of InnerPolyline.
Constructor Details
#initialize(shape: nil, raw_coordinates: [], sequence: nil) ⇒ InnerPolyline
Returns a new instance of InnerPolyline.
9 10 11 12 13 14 15 16 17 |
# File 'lib/contrek/finder/concurrent/inner_polyline.rb', line 9 def initialize(shape: nil, raw_coordinates: [], sequence: nil) if sequence @shape = sequence.shape @raw = sequence.to_a else @shape = shape @raw = raw_coordinates end end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/contrek/finder/concurrent/inner_polyline.rb', line 6 def raw @raw end |
#shape ⇒ Object
Returns the value of attribute shape.
7 8 9 |
# File 'lib/contrek/finder/concurrent/inner_polyline.rb', line 7 def shape @shape end |
#vertical_bounds ⇒ Object (readonly)
Returns the value of attribute vertical_bounds.
6 7 8 |
# File 'lib/contrek/finder/concurrent/inner_polyline.rb', line 6 def vertical_bounds @vertical_bounds end |
Instance Method Details
#compute_vertical_bounds! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/contrek/finder/concurrent/inner_polyline.rb', line 19 def compute_vertical_bounds! @vertical_bounds ||= begin min_y = Float::INFINITY max_y = 0 @raw.each do |pos| y = pos[:y] min_y = y if y < min_y max_y = y if y > max_y end {min: min_y, max: max_y} end end |