Class: Wildfire::Converter::Orderer
- Inherits:
-
Object
- Object
- Wildfire::Converter::Orderer
- Defined in:
- lib/wildfire/converter/orderer.rb
Class Method Summary collapse
Class Method Details
.to_tl_tr_br_bl(points) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/wildfire/converter/orderer.rb', line 5 def to_tl_tr_br_bl(points) bottom_left = points.sort { |p| p[0] + p[1] }.last top_right = points.sort { |p| p[0] + p[1] }.first other = points - [top_right, bottom_left] bottom_right = other.sort { |p| p[0] - p[1] }.first top_left = other.sort { |p| p[0] - p[1] }.last [top_left, top_right, bottom_right, bottom_left] end |