Module: EightCorner::Quadrant

Defined in:
lib/eight_corner/quadrant.rb

Overview

a Bounds has 4 quadrants. TODO: singleton instance for each quadrant? would allow each to return their own angle_range_for.

Constant Summary collapse

UPPER_LEFT =
0
UPPER_RIGHT =
1
LOWER_RIGHT =
2
LOWER_LEFT =
3

Class Method Summary collapse

Class Method Details

.angle_range_for(quad) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/eight_corner/quadrant.rb', line 12

def self.angle_range_for(quad)
  # the valid range of angles (to the next point)
  # based on the quadrant the current point is in.
  {
    UPPER_LEFT  => 30..240,
    UPPER_RIGHT => 120..330,
    LOWER_LEFT  => 300..(330+180),
    LOWER_RIGHT => 210..(330+90)
  }[quad]
end