header_utils
Loading...
Searching...
No Matches
Direction

Contains the direction type, which represents one of the eight cardinal compass directions. More...

Typedefs

using ghassanpl::geometry::direction_set

Enumerations

enum class  direction {
  none , right , right_down , down ,
  left_down , left , left_up , up ,
  right_up , east , south_east , south ,
  south_west , west , north_west , north ,
  north_east
}

Functions

constexpr direction ghassanpl::geometry::operator+ (direction dir, int d)
constexpr direction ghassanpl::geometry::operator- (direction dir, int d)
constexpr direction & ghassanpl::geometry::operator++ (direction &dir)
constexpr direction & ghassanpl::geometry::operator-- (direction &dir)
constexpr direction ghassanpl::geometry::operator++ (direction &dir, int)
constexpr direction ghassanpl::geometry::operator-- (direction &dir, int)
constexpr direction ghassanpl::geometry::opposite (direction dir)
constexpr direction ghassanpl::geometry::next_cardinal (direction dir)
constexpr direction ghassanpl::geometry::prev_cardinal (direction dir)
constexpr const char * ghassanpl::geometry::to_name (direction dir)
constexpr const char * ghassanpl::geometry::to_compass_name (direction dir)
constexpr bool ghassanpl::geometry::is_valid (direction dir)
constexpr bool ghassanpl::geometry::is_cardinal (direction dir)
constexpr bool ghassanpl::geometry::is_diagonal (direction dir)
constexpr direction_set ghassanpl::geometry::to_cardinal_set (direction dir)
 Turns a diagonal direction into a set of cardinals (e.g. to_cardinal_set(north_west) -> direction_set{north, west}).
constexpr int ghassanpl::geometry::horizontal (direction dir)
 Returns the horizontal offset (-1, 0, or 1) of dir.
constexpr int ghassanpl::geometry::vertical (direction dir)
 Returns the vertical offset (-1, 0, or 1) of dir.
constexpr degrees ghassanpl::geometry::to_angle (direction val)
constexpr glm::ivec2 ghassanpl::geometry::to_ivec (direction val)
constexpr glm::vec2 ghassanpl::geometry::to_vec (direction val)
constexpr align ghassanpl::geometry::to_alignment (direction val)
constexpr direction ghassanpl::geometry::to_direction (align val)
constexpr direction ghassanpl::geometry::to_direction (degrees angle)
constexpr direction ghassanpl::geometry::to_direction (glm::vec2 val)
constexpr direction ghassanpl::geometry::to_direction (glm::ivec2 vec)

Variables

static constexpr auto ghassanpl::geometry::direction_count
constexpr direction_set ghassanpl::geometry::all_cardinal_directions
constexpr direction_set ghassanpl::geometry::all_diagonal_directions
constexpr direction_set ghassanpl::geometry::all_directions

Detailed Description

Contains the direction type, which represents one of the eight cardinal compass directions.

Typedef Documentation

◆ direction_set

using ghassanpl::geometry::direction_set

Definition at line 44 of file direction.h.

Enumeration Type Documentation

◆ direction

enum class ghassanpl::geometry::direction
strong

Definition at line 19 of file direction.h.

Function Documentation

◆ horizontal()

int ghassanpl::geometry::horizontal ( direction dir)
constexpr

Returns the horizontal offset (-1, 0, or 1) of dir.

Definition at line 97 of file direction.h.

◆ is_cardinal()

bool ghassanpl::geometry::is_cardinal ( direction dir)
constexpr

Definition at line 86 of file direction.h.

◆ is_diagonal()

bool ghassanpl::geometry::is_diagonal ( direction dir)
constexpr

Definition at line 87 of file direction.h.

◆ is_valid()

bool ghassanpl::geometry::is_valid ( direction dir)
constexpr

Definition at line 85 of file direction.h.

◆ next_cardinal()

direction ghassanpl::geometry::next_cardinal ( direction dir)
constexpr

Definition at line 61 of file direction.h.

◆ operator+()

direction ghassanpl::geometry::operator+ ( direction dir,
int d )
constexpr

Definition at line 51 of file direction.h.

◆ operator++() [1/2]

direction & ghassanpl::geometry::operator++ ( direction & dir)
constexpr

Definition at line 54 of file direction.h.

◆ operator++() [2/2]

direction ghassanpl::geometry::operator++ ( direction & dir,
int  )
constexpr

Definition at line 57 of file direction.h.

◆ operator-()

direction ghassanpl::geometry::operator- ( direction dir,
int d )
constexpr

Definition at line 52 of file direction.h.

◆ operator--() [1/2]

direction & ghassanpl::geometry::operator-- ( direction & dir)
constexpr

Definition at line 55 of file direction.h.

◆ operator--() [2/2]

direction ghassanpl::geometry::operator-- ( direction & dir,
int  )
constexpr

Definition at line 58 of file direction.h.

◆ opposite()

direction ghassanpl::geometry::opposite ( direction dir)
constexpr

Definition at line 60 of file direction.h.

◆ prev_cardinal()

direction ghassanpl::geometry::prev_cardinal ( direction dir)
constexpr

Definition at line 62 of file direction.h.

◆ to_alignment()

align ghassanpl::geometry::to_alignment ( direction val)
constexpr

Definition at line 114 of file direction.h.

◆ to_angle()

degrees ghassanpl::geometry::to_angle ( direction val)
constexpr

Definition at line 102 of file direction.h.

◆ to_cardinal_set()

direction_set ghassanpl::geometry::to_cardinal_set ( direction dir)
constexpr

Turns a diagonal direction into a set of cardinals (e.g. to_cardinal_set(north_west) -> direction_set{north, west}).

Definition at line 90 of file direction.h.

◆ to_compass_name()

const char * ghassanpl::geometry::to_compass_name ( direction dir)
constexpr

Definition at line 83 of file direction.h.

◆ to_direction() [1/4]

direction ghassanpl::geometry::to_direction ( align val)
constexpr

Definition at line 130 of file direction.h.

◆ to_direction() [2/4]

direction ghassanpl::geometry::to_direction ( degrees angle)
constexpr

Definition at line 146 of file direction.h.

◆ to_direction() [3/4]

direction ghassanpl::geometry::to_direction ( glm::ivec2 vec)
constexpr

Definition at line 156 of file direction.h.

◆ to_direction() [4/4]

direction ghassanpl::geometry::to_direction ( glm::vec2 val)
constexpr

Definition at line 151 of file direction.h.

◆ to_ivec()

glm::ivec2 ghassanpl::geometry::to_ivec ( direction val)
constexpr

Definition at line 111 of file direction.h.

◆ to_name()

const char * ghassanpl::geometry::to_name ( direction dir)
constexpr

Definition at line 82 of file direction.h.

◆ to_vec()

glm::vec2 ghassanpl::geometry::to_vec ( direction val)
constexpr

Definition at line 112 of file direction.h.

◆ vertical()

int ghassanpl::geometry::vertical ( direction dir)
constexpr

Returns the vertical offset (-1, 0, or 1) of dir.

Definition at line 100 of file direction.h.

Variable Documentation

◆ all_cardinal_directions

direction_set ghassanpl::geometry::all_cardinal_directions
inlineconstexpr

Definition at line 64 of file direction.h.

◆ all_diagonal_directions

direction_set ghassanpl::geometry::all_diagonal_directions
inlineconstexpr

Definition at line 65 of file direction.h.

◆ all_directions

direction_set ghassanpl::geometry::all_directions
inlineconstexpr

Definition at line 66 of file direction.h.

◆ direction_count

auto ghassanpl::geometry::direction_count
staticconstexpr

Definition at line 42 of file direction.h.