cubos::core::geom::Box struct

Represents a box shape.

Public static functions

static void enclosingFaces(int vertexIndex, int faces[3])
Computes the enclosing faces of the corner.
static void edges(glm::ivec2 edges[12])
Computes the edges of a box. An edge is a pair of the corner indexes that compose it.
static void edgeAdjacentFaces(int edgeIndex, int faces[2])
Computes the faces adjacent to an edge.
static void faceEdges(int faceIndex, int edges[4])
Computes the edges of a face.
static void faces(glm::ivec4 faces[6])
Computes the faces with regards to the corner indexes that compose them. In conter-clock wise winding order.
static void faceNormals(glm::vec3 normals[6])
Computes the normal of each face. Same order as faces.

Public functions

void diag(glm::vec3 corners[2]) const
Computes two opposite corners of the box on the major diagonal.
void corners4(glm::vec3 corners[4]) const
Computes four corners of the box, one for each diagonal.
void corners(glm::vec3 corners[8]) const
Computes the eight corners of the box, opposite corners are adjacent in the array.

Public variables

glm::vec3 halfSize
Half size of the box.

Function documentation

static void cubos::core::geom::Box::enclosingFaces(int vertexIndex, int faces[3])

Computes the enclosing faces of the corner.

Parameters
vertexIndex Index of the corner, according to the returned by corners.
faces Array to store the three face indexes in, according to the returned by faces.

static void cubos::core::geom::Box::edges(glm::ivec2 edges[12])

Computes the edges of a box. An edge is a pair of the corner indexes that compose it.

Parameters
edges Array to store the twelve edges in.

static void cubos::core::geom::Box::edgeAdjacentFaces(int edgeIndex, int faces[2])

Computes the faces adjacent to an edge.

Parameters
edgeIndex Index of the edge.
faces Array to store the two faces in.

static void cubos::core::geom::Box::faceEdges(int faceIndex, int edges[4])

Computes the edges of a face.

Parameters
faceIndex Index of the face.
edges Array to store the four edges in.

static void cubos::core::geom::Box::faces(glm::ivec4 faces[6])

Computes the faces with regards to the corner indexes that compose them. In conter-clock wise winding order.

Parameters
faces Array to store the six faces in.

static void cubos::core::geom::Box::faceNormals(glm::vec3 normals[6])

Computes the normal of each face. Same order as faces.

Parameters
normals Array to store the normals in.

void cubos::core::geom::Box::diag(glm::vec3 corners[2]) const

Computes two opposite corners of the box on the major diagonal.

Parameters
corners Array to store the two corners in.

void cubos::core::geom::Box::corners4(glm::vec3 corners[4]) const

Computes four corners of the box, one for each diagonal.

Parameters
corners Array to store the four corners in.

void cubos::core::geom::Box::corners(glm::vec3 corners[8]) const

Computes the eight corners of the box, opposite corners are adjacent in the array.

Parameters
corners Array to store the eight corners in.