cubexx::face_t

struct cubexx::face_t

Represents a face of a cube.

There are 6 faces in a cube. A face_t is 1:1 equivalent to a direction_t; they can be converted from one to the other via face_t::direction() and direction_t::face().

See
direction_t

Public Functions

face_t()

Default construct a “null” face.

const direction_t &direction() const

Return the direction that is equivalent to this face.

const face_t &opposite() const

Return the opposite face.

const std::array<face_t, 4> &adjacents() const

Return the 4 adjacent faces.

const face_set_t &adjacent_set() const

Return a face_set_t containing the 4 adjacent faces.

const std::array<corner_t, 4> &corners() const

Return the 4 corners on this face.

const corner_set_t &corner_set() const

Return a corner_set_t containing the 4 corners on this face.

const std::array<edge_t, 4> &edges() const

Return the 4 edges on this face.

const edge_set_t &edge_set() const

Return the 4 edges on this face.

const face_t &flip(const edge_t &edge) const

Return a face that shares a (specified) common edge.

const std::array<edge_t, 4> &perpendicular_edges() const

Return the 4 (perpendicular) edges touching this face, but not directly on the face.

bool is_adjacent(const corner_t &corner) const

Returns true if.

Parameters
  • corner -

    is a corner adjacent to this face; otherwise returns false.

bool is_adjacent(const face_t &other) const

Returns true if.

Note
that this will NOT return true for (*this).is_adjacent(*this).
Parameters
  • other -

    is a face adjacent to this face; otherwise returns false.

bool is_adjacent(const edge_t &edge) const

Returns true if.

Parameters
  • edge -

    is an edge adjacent to this face; otherwise returns false.

std::uint_fast8_t index() const

Retrieve a numeric 0-based index for the face, for use in indexing when storing in an array, or for comparison when storing in a container requiring comparison.

The index will be less than SIZE(). The “null” face has no index, and it is illegal to call index() on it.

See
get(std::uint_fast8_t idx)

bool operator<(const face_t &other) const

Comparison.

bool operator==(const face_t &other) const

Comparison.

bool operator!=(const face_t &other) const

Comparison.

bool is_null() const

Returns true if this face is a null face_t.

Public Static Functions

static const std::array<face_t, 6> &all()

Return a list of all the faces on the cube.

static const face_t &get(const direction_t &direction)

Return the face equivalent to a specified direction.

static const face_t &get(const std::uint_fast8_t &idx)

Return the face represented by an index.

See
index()

static const face_t &null_face()

Returns a null direction.

static std::size_t SIZE()

Number of faces.