Area.Orientation module

Functions for working with orientations.

Usage

local Orientation = require('__stdlib__/stdlib/area/orientation')

Functions

to_direction(orientation[, eight_way=false]) Returns a 4way or 8way direction from an orientation.
opposite(orientation) Returns the opposite orientation.
add(orientation1, orientation2) Add two orientations together.

Fields

north north orientation
east east orientation
west west orientation
south south orientation
northeast northeast orientation
northwest northwest orientation
southeast southeast orientation
southwest southwest orientation

Functions

# to_direction(orientation[, eight_way=false])

Returns a 4way or 8way direction from an orientation.

Parameters:
  • orientation : (float)
  • eight_way : (boolean) (default: false)
Returns:
# opposite(orientation)

Returns the opposite orientation.

Parameters: Returns:
  • (float) the opposite orientation
# add(orientation1, orientation2)

Add two orientations together.

Parameters: Returns:
  • (float) the orientations added together

Fields

# north

north orientation

# east

east orientation

# west

west orientation

# south

south orientation

# northeast

northeast orientation

# northwest

northwest orientation

# southeast

southeast orientation

# southwest

southwest orientation