Class: Qrio::HorizontalMatch

Inherits:
FinderPatternSlice show all
Defined in:
lib/qrio/horizontal_match.rb

Constant Summary

Constants inherited from FinderPatternSlice

FinderPatternSlice::ENDPOINT_TOLERANCE, FinderPatternSlice::LENGTH_TOLERANCE, FinderPatternSlice::OFFSET_TOLERANCE, FinderPatternSlice::ONE, FinderPatternSlice::THREE, FinderPatternSlice::WIDTH_TOLERANCE

Instance Attribute Summary

Attributes inherited from FinderPatternSlice

#neighbors

Attributes inherited from Region

#orientation, #x1, #x2, #y1, #y2

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FinderPatternSlice

#<=>, #adjacent?, #aspect_ratio, #breadth_diff, #breadth_matches?, build_matching, #class_name_prefix, #endpoints_match?, #initialize, #intersects?, #length_diff, #length_matches?, #matches_aspect_ratio?, matches_ratio?, #normalized_offset_diff, normalized_ratio, #offset_matches?, #origin_diff, #origin_matches?, #terminus_diff, #terminus_matches?, #to_s

Methods inherited from Region

#==, #bottom, #bottom_right, #center, #eql?, #hash, #height, #horizontal?, #initialize, #left, #orientation_matches?, #right, #rotate, #to_coordinates, #to_point_size, #to_s, #top, #top_left, #translate, #union, #vertical?, #width

Constructor Details

This class inherits a constructor from Qrio::FinderPatternSlice

Class Method Details

.build(offset, origin, terminus) ⇒ Object



3
4
5
# File 'lib/qrio/horizontal_match.rb', line 3

def self.build(offset, origin, terminus)
  new(origin, offset, terminus, offset)
end

Instance Method Details

#above?(other) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/qrio/horizontal_match.rb', line 19

def above?(other)
  other.top > bottom
end

#below?(other) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/qrio/horizontal_match.rb', line 23

def below?(other)
  other.bottom < top
end

#breadthObject



15
16
17
# File 'lib/qrio/horizontal_match.rb', line 15

def breadth
  height
end

#lengthObject



11
12
13
# File 'lib/qrio/horizontal_match.rb', line 11

def length
  width
end

#offsetObject



7
# File 'lib/qrio/horizontal_match.rb', line 7

def offset;   top;   end

#offset_diff(other) ⇒ Object



27
28
29
# File 'lib/qrio/horizontal_match.rb', line 27

def offset_diff(other)
  above?(other) ? other.top - bottom : top - other.bottom
end

#originObject



8
# File 'lib/qrio/horizontal_match.rb', line 8

def origin;   left;  end

#terminusObject



9
# File 'lib/qrio/horizontal_match.rb', line 9

def terminus; right; end