Public Member Functions | |
Tetra (const vector< Vec > &vertices, const FourIndices &vertexIndices, const FourFaces &faces) | |
const Vec & | centroid () const |
bool | contains (const Position &bfr) const |
double | diagonal () const |
Vec | edge (int t1, int t2) const |
const Box & | extent () const |
const FourFaces & | faces () const |
int | findEnteringFace (const Vec &pos, const Direction &dir) const |
double | generateBarycentric (double &s, double &t, double &u) const |
Position | generatePosition (Random *random) const |
Vec | vertex (int t) const |
double | volume () const |
Private Attributes | |
Vec | _centroid |
Box | _extent |
FourFaces | _faces |
FourIndices | _vertexIndices |
const vector< Vec > & | _vertices |
Private class that represents a tetrahedron, storing all relevant information to fully describe its geometry and allow photon traversal through it.
TetraMeshSpatialGrid::Tetra::Tetra | ( | const vector< Vec > & | vertices, |
const FourIndices & | vertexIndices, | ||
const FourFaces & | faces | ||
) |
This constructor initializes the tetrahedron by setting its fields and calculating the bounding box and centroid.
const Vec & TetraMeshSpatialGrid::Tetra::centroid | ( | ) | const |
This function returns the centroid of the tetrahedron.
bool TetraMeshSpatialGrid::Tetra::contains | ( | const Position & | bfr | ) | const |
This function checks if the given position is contained inside the tetrahedron. It first checks if the position is inside the bounding box of the tetrahedron.
double TetraMeshSpatialGrid::Tetra::diagonal | ( | ) | const |
This function calculates and returns the approximate diagonal of the tetrahedron. It calculates the square root of the average of the squared edge lengths.
Vec TetraMeshSpatialGrid::Tetra::edge | ( | int | t1, |
int | t2 | ||
) | const |
This function returns the edge from vertex
const Box & TetraMeshSpatialGrid::Tetra::extent | ( | ) | const |
This function returns the extent of the tetrahedron.
const FourFaces & TetraMeshSpatialGrid::Tetra::faces | ( | ) | const |
This function returns a reference to an array of the faces of the tetrahedron.
This function finds a face that is not the leaving face which can act as the entering face in the traversal algorithm.
double TetraMeshSpatialGrid::Tetra::generateBarycentric | ( | double & | s, |
double & | t, | ||
double & | u | ||
) | const |
This function generates a random position inside the tetrahedron by generating random barycentric coordinates and using the vertices of the tetrahedron.
Vec TetraMeshSpatialGrid::Tetra::vertex | ( | int | t | ) | const |
This function returns the vertex with index
double TetraMeshSpatialGrid::Tetra::volume | ( | ) | const |
This function calculates and returns the volume of the tetrahedron.