cubelib_direction_t¶
////////////////////////////////////////////////////////////////////////////////
//Headers
////////////////////////////////////////////////////////////////////////////////
//forward declarations
#include <cubelib/cubelib.fwd.h>
//API
#include <cubelib/cubelib.h>
-
group
cubelib-direction-group This is the API for cubelib_direction_t.
Typedefs
-
typedef
cubelib_direction_t¶ Struct that represents a direction.
Functions
-
bool
cubelib_is_direction_valid(cubelib_direction_t direction)¶ Checks that a direction is not corrupted somehow and represents a valid direction (including a null direction).
- See
- cubelib_is_direction_null(), cubelib_null_direction, CUBELIB_NULL_DIRECTION
-
bool
cubelib_is_direction_null(cubelib_direction_t direction)¶ Returns true if this corner is a null corner.
-
bool
cubelib_is_direction_equal(cubelib_direction_t left, cubelib_direction_t right)¶ Comparison.
-
int
cubelib_get_direction_x(cubelib_direction_t direction)¶ Returns the x-component of the vector representation of this direction.
-
int
cubelib_get_direction_y(cubelib_direction_t direction)¶ Returns the y-component of the vector representation of this direction.
-
int
cubelib_get_direction_z(cubelib_direction_t direction)¶ Returns the z-component of the vector representation of this direction.
-
int
cubelib_get_direction_i(cubelib_direction_t direction, uint_fast8_t dim)¶ Returns the specified ith-component of the vector representation of this direction.
-
uint_fast8_t
cubelib_get_direction_absx(cubelib_direction_t direction)¶ Returns the absolute value of the x-component of the vector representation of this direction.
-
uint_fast8_t
cubelib_get_direction_absy(cubelib_direction_t direction)¶ Returns the absolute value of the y-component of the vector representation of this direction.
-
uint_fast8_t
cubelib_get_direction_absz(cubelib_direction_t direction)¶ Returns the absolute value of the z-component of the vector representation of this direction.
-
uint_fast8_t
cubelib_get_direction_absi(cubelib_direction_t direction, uint_fast8_t dim)¶ Returns the absolute value of the ith-component of the vector representation of this direction.
-
uint_fast8_t
cubelib_get_direction_sigdim(cubelib_direction_t direction)¶ Returns the dimension of the vector-representation of a direction that has a non-zero value.
So for example, :math:
(1,0,0)will result in0; :math:(0,-1,0)will be1; :math:(0,0,-1)will be2.
-
uint_fast8_t
cubelib_get_direction_index(cubelib_direction_t direction)¶ Returns a 0-based index that represents this direction; for use in array indexing and similar.
-
cubelib_direction_t
cubelib_get_direction_by_index(uint_fast8_t index)¶ Return a direction based on the 0-based index returned by cubelib_get_direction_index().
-
cubelib_direction_t
cubelib_get_direction_by_int3(int x, int y, int z)¶ Returns a direction represented by a given 3 component vector.
Examples:
cubelib_get_direction_by_int3(0,+1,0)Returns a direction pointing in the direction of the positive Y axis from the the center of the cubecubelib_get_direction_by_int3(0,0,-1)Returns a direction pointing in the direction of the negative Z axis from the the center of the cube
- Note
- two of the components must be zero, and one component must be non-zero.
-
cubelib_direction_t
cubelib_get_opposite_direction(cubelib_direction_t direction)¶ Returns the opposite direction.
-
cubelib_face_t
cubelib_get_direction_face(cubelib_direction_t direction)¶ convert a direction to a face
- See
- cubelib_face_t, cubelib_get_face_direction()
-
struct
cubelib_direction_t¶ - #include <cubelib/cubelib.h>
Struct that represents a direction.
-
typedef