kodi
Static Public Member Functions | List of all members
KODI::INPUT::CInputTranslator Class Reference

Static Public Member Functions

static CARDINAL_DIRECTION VectorToCardinalDirection (float x, float y)
 Get the closest cardinal direction to the given vector. More...
 
static INTERCARDINAL_DIRECTION VectorToIntercardinalDirection (float x, float y)
 Get the closest cardinal or intercardinal direction to the given vector. More...
 

Member Function Documentation

◆ VectorToCardinalDirection()

CARDINAL_DIRECTION CInputTranslator::VectorToCardinalDirection ( float  x,
float  y 
)
static

Get the closest cardinal direction to the given vector.

This function assumes a right-handed cartesian coordinate system; positive X is right, positive Y is up.

Ties are resolved in the clockwise direction: (0.5, 0.5) will resolve to RIGHT.

Parameters
xThe x component of the vector
yThe y component of the vector
Returns
The closest cardinal direction (up, down, right or left), or CARDINAL_DIRECTION::NONE if x and y are both 0

◆ VectorToIntercardinalDirection()

INTERCARDINAL_DIRECTION CInputTranslator::VectorToIntercardinalDirection ( float  x,
float  y 
)
static

Get the closest cardinal or intercardinal direction to the given vector.

This function assumes a right-handed cartesian coordinate system; positive X is right, positive Y is up.

Ties are resolved in the clockwise direction.

Parameters
xThe x component of the vector
yThe y component of the vector
Returns
The closest intercardinal direction, or INTERCARDINAL_DIRECTION::NONE if x and y are both 0

The documentation for this class was generated from the following files: