Class: Qrio::VerticalMatch

Inherits:
FinderPatternSlice show all
Defined in:
lib/qrio/vertical_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/vertical_match.rb', line 3

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

Instance Method Details

#breadthObject



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

def breadth
  width
end

#left_of?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

def left_of?(other)
  right < other.left
end

#lengthObject



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

def length
  height
end

#offsetObject



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

def offset;   left;   end

#offset_diff(other) ⇒ Object



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

def offset_diff(other)
  left_of?(other) ? other.left - right : left - other.right
end

#originObject



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

def origin;   top;    end

#right_of?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

def right_of?(other)
  left > other.right
end

#terminusObject



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

def terminus; bottom; end