2 * Copyright (C) 2018-2024 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "InputTypes.h"
17 class CInputTranslator
21 * \brief Get the closest cardinal direction to the given vector
23 * This function assumes a right-handed cartesian coordinate system; positive
24 * X is right, positive Y is up.
26 * Ties are resolved in the clockwise direction: (0.5, 0.5) will resolve to
29 * \param x The x component of the vector
30 * \param y The y component of the vector
32 * \return The closest cardinal direction (up, down, right or left), or
33 * CARDINAL_DIRECTION::NONE if x and y are both 0
35 static CARDINAL_DIRECTION
VectorToCardinalDirection(float x
, float y
);
38 * \brief Get the closest cardinal or intercardinal direction to the given
41 * This function assumes a right-handed cartesian coordinate system; positive
42 * X is right, positive Y is up.
44 * Ties are resolved in the clockwise direction.
46 * \param x The x component of the vector
47 * \param y The y component of the vector
49 * \return The closest intercardinal direction, or
50 * INTERCARDINAL_DIRECTION::NONE if x and y are both 0
52 static INTERCARDINAL_DIRECTION
VectorToIntercardinalDirection(float x
, float y
);