Core 1.0
Cuboid Class Reference

Cuboids. More...

#include <cuboid.h>

Public Member Functions

 Cuboid (const Box &)
 Create a cuboid.
 Cuboid (const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &)
 Create a cuboid given vertexes.
 ~Cuboid ()
 Empty.
Vectoroperator[] (int)
 Returns either end vertex of the box.
Vector operator[] (int) const
 Overloaded.
Vector Vertex (int) const
 Returns the i-th vertex of the cuboid.
Vector Vertex (int, int) const
 Returns the j-th vertex of i-th quadrangle face of the cuboid.
Vector Normal (int) const
 Returns the normal to the i-th quadrangle face of the cuboid.
Quadrangle GetQuadrangle (int) const
 Returns tthe i-th quadrangle.
void Translate (const Vector &)
 Translates a cuboid.
void Rotate (const Matrix &)
 Rotates a cuboid.
void Scale (const Vector &)
 Scales a cuboid.
double Area () const
 Compute the area.

Static Public Attributes

static const int edge [24]
 Edge vertices.
static const int quadrangle [24]
 Quadrangle faces.

Protected Attributes

Vector a [8]
 Vertexes.

Detailed Description

Cuboids.

Cuboids implement convex hexahedra, i.e. polyhedra with six faces.

Constructor & Destructor Documentation

◆ Cuboid() [1/2]

Cuboid::Cuboid ( const Box & box)
explicit

Create a cuboid.

Parameters
boxThe box.

◆ Cuboid() [2/2]

Cuboid::Cuboid ( const Vector & a000,
const Vector & a100,
const Vector & a010,
const Vector & a110,
const Vector & a001,
const Vector & a101,
const Vector & a011,
const Vector & a111 )
explicit

Create a cuboid given vertexes.

Parameters
a000,a100,a010,a110,a001,a101,a011,a111Vertexes.

Member Function Documentation

◆ GetQuadrangle()

Quadrangle Cuboid::GetQuadrangle ( int i) const
inline

Returns tthe i-th quadrangle.

Parameters
iQuadrangle index.

◆ Normal()

Vector Cuboid::Normal ( int i) const
inline

Returns the normal to the i-th quadrangle face of the cuboid.

Parameters
iQuadrangle index.

◆ Rotate()

void Cuboid::Rotate ( const Matrix & r)

Rotates a cuboid.

Parameters
rRotation matrix.

◆ Scale()

void Cuboid::Scale ( const Vector & s)

Scales a cuboid.

Note that this function handles negative coefficients in the scaling vector (by swapping coordinates if need be).

Parameters
sScaling vector.

◆ Translate()

void Cuboid::Translate ( const Vector & t)

Translates a cuboid.

Parameters
tTranslation vector.

◆ Vertex() [1/2]

Vector Cuboid::Vertex ( int i) const
inline

Returns the i-th vertex of the cuboid.

Same as operator[].

Parameters
iVertex.

◆ Vertex() [2/2]

Vector Cuboid::Vertex ( int i,
int j ) const
inline

Returns the j-th vertex of i-th quadrangle face of the cuboid.

Parameters
iQuadrangle.
jVertex.