Ocean
Ocean::Rendering::TriangleFace Class Reference

Definition of a triangle face with three vertex indices. More...

Public Member Functions

 TriangleFace ()
 Creates a new triangle face object with undefined indices. More...
 
 TriangleFace (const VertexIndex startIndex)
 Creates a new triangle face object with successive indices. More...
 
 TriangleFace (const VertexIndex first, const VertexIndex second, const VertexIndex third)
 Creates a new triangle face object with three given indices. More...
 
 TriangleFace (const VertexIndex *arrayValue)
 Creates a new triangle face object by an array of at least three indices. More...
 
VertexIndex index (const unsigned int index) const
 Returns a specific vertex index specified by it's index inside the face. More...
 
VertexIndexindex (const unsigned int index)
 Returns a specific vertex index specified by it's index inside the face. More...
 
VertexIndex operator[] (const unsigned int index) const
 Returns a specific vertex index specified by it's index inside the face. More...
 
VertexIndexoperator[] (const unsigned int index)
 Returns a specific vertex index specified by it's index inside the face. More...
 
const VertexIndexoperator() () const
 Returns the pointer to the first element of the vertex indices. More...
 
VertexIndexoperator() ()
 Returns the pointer to the first element of the vertex indices. More...
 
bool operator== (const TriangleFace &triangleFace) const
 Returns whether two triangle face objects are identical. More...
 
bool operator!= (const TriangleFace &triangleFace) const
 Returns whether two triangle face objects are not identical. More...
 
size_t operator() (const Rendering::TriangleFace &triangleFace) const
 Hash function for a TriangleFace object. More...
 

Static Public Member Functions

static Vectors3 calculatePerFaceNormals (const TriangleFaces &faces, const Vertices &vertices, const bool counterClockWise=true)
 Calculates per-face normals for a given set of triangles. More...
 
static Vectors3 calculateSmoothedPerVertexNormals (const TriangleFaces &faces, const Vertices &vertices, const Vectors3 &perFaceNormals)
 Calculates smoothed per-vertex normals for a given set of triangles and per-face normals. More...
 
static bool calculateSmoothedPerVertexNormals (const TriangleFaces &faces, const Vectors3 &vertices, Vectors3 &normals, const Scalar creaseAngle)
 Recalculates smoothed per-vertex normals for a given set of triangles with per vertex normals. More...
 
static Vectors3 calculateSmoothedPerVertexNormals (const TriangleFaces &faces, const Vectors3 &vertices)
 Calculates smoothed per-vertexnormals for a given set of triangles. More...
 
static TriangleFaces indices2triangleFaces (const Index32 *indices, const size_t size)
 Convertes indices of triangles to triangle faces. More...
 

Protected Types

typedef std::map< Vertex, VertexIndicesVertexMap
 Definition of a map mapping vertices to their corresponding face indices. More...
 

Protected Attributes

VertexIndex indices_ [3]
 The three vertex indices. More...
 

Detailed Description

Definition of a triangle face with three vertex indices.

Member Typedef Documentation

◆ VertexMap

Definition of a map mapping vertices to their corresponding face indices.

Constructor & Destructor Documentation

◆ TriangleFace() [1/4]

Ocean::Rendering::TriangleFace::TriangleFace ( )
inline

Creates a new triangle face object with undefined indices.

◆ TriangleFace() [2/4]

Ocean::Rendering::TriangleFace::TriangleFace ( const VertexIndex  startIndex)
inlineexplicit

Creates a new triangle face object with successive indices.


The first index is given, the following indices will be set to successive values.

Parameters
startIndexIndex of the first vertex

◆ TriangleFace() [3/4]

Ocean::Rendering::TriangleFace::TriangleFace ( const VertexIndex  first,
const VertexIndex  second,
const VertexIndex  third 
)
inline

Creates a new triangle face object with three given indices.

Parameters
firstFirst vertex index
secondSecond vertex index
thirdThird vertex index

◆ TriangleFace() [4/4]

Ocean::Rendering::TriangleFace::TriangleFace ( const VertexIndex arrayValue)
inlineexplicit

Creates a new triangle face object by an array of at least three indices.

Parameters
arrayValueArray with at least three vertex indices

Member Function Documentation

◆ calculatePerFaceNormals()

static Vectors3 Ocean::Rendering::TriangleFace::calculatePerFaceNormals ( const TriangleFaces faces,
const Vertices vertices,
const bool  counterClockWise = true 
)
static

Calculates per-face normals for a given set of triangles.

Parameters
facesThe triangle faces
verticesThe triangle vertices corresponding to the faces
counterClockWiseTrue, if the faces are provides so that a front face is determined in a counter clockwise order The resulting per-face normals, one for each faces

◆ calculateSmoothedPerVertexNormals() [1/3]

static Vectors3 Ocean::Rendering::TriangleFace::calculateSmoothedPerVertexNormals ( const TriangleFaces faces,
const Vectors3 vertices 
)
static

Calculates smoothed per-vertexnormals for a given set of triangles.

Parameters
facesThe triangle faces
verticesThe triangle vertices corresponding to the faces
Returns
The resulting smoothed per-vertex normals

◆ calculateSmoothedPerVertexNormals() [2/3]

static bool Ocean::Rendering::TriangleFace::calculateSmoothedPerVertexNormals ( const TriangleFaces faces,
const Vectors3 vertices,
Vectors3 normals,
const Scalar  creaseAngle 
)
static

Recalculates smoothed per-vertex normals for a given set of triangles with per vertex normals.

Parameters
facesThe triangle faces
verticesThe triangle vertices corresponding to the faces
normalsThe per-vertex normals, which are not smoothed yet
creaseAngleCrease angle defining the seperation between per face and per vertex normals in radian, with range [0, PI/2]
Returns
True, if succeeded

◆ calculateSmoothedPerVertexNormals() [3/3]

static Vectors3 Ocean::Rendering::TriangleFace::calculateSmoothedPerVertexNormals ( const TriangleFaces faces,
const Vertices vertices,
const Vectors3 perFaceNormals 
)
static

Calculates smoothed per-vertex normals for a given set of triangles and per-face normals.

Parameters
facesThe triangle faces
verticesThe triangle vertices corresponding to the faces
perFaceNormalsThe per-face normals The resulting per-vertex normals, one for each vertex

◆ index() [1/2]

VertexIndex & Ocean::Rendering::TriangleFace::index ( const unsigned int  index)
inline

Returns a specific vertex index specified by it's index inside the face.

Beware: No range check will be done!

Parameters
indexIndex of the vertex index with range [0, 2]
Returns
Specified vertex index

◆ index() [2/2]

VertexIndex Ocean::Rendering::TriangleFace::index ( const unsigned int  index) const
inline

Returns a specific vertex index specified by it's index inside the face.

Beware: No range check will be done!

Parameters
indexIndex of the vertex index with range [0, 2]
Returns
Specified vertex index

◆ indices2triangleFaces()

TriangleFaces Ocean::Rendering::TriangleFace::indices2triangleFaces ( const Index32 indices,
const size_t  size 
)
inlinestatic

Convertes indices of triangles to triangle faces.

Parameters
indicesThe indices of the triangle, must be valid
sizeThe number of indices, with range [3, infinity), must be a multiple of 3
Returns
The resulting triangle faces

◆ operator!=()

bool Ocean::Rendering::TriangleFace::operator!= ( const TriangleFace triangleFace) const
inline

Returns whether two triangle face objects are not identical.

Parameters
triangleFaceThe second object to compare
Returns
True, if so

◆ operator()() [1/3]

VertexIndex * Ocean::Rendering::TriangleFace::operator() ( )
inline

Returns the pointer to the first element of the vertex indices.

Returns
Array with vertex indices

◆ operator()() [2/3]

const VertexIndex * Ocean::Rendering::TriangleFace::operator() ( ) const
inline

Returns the pointer to the first element of the vertex indices.

Returns
Array with vertex indices

◆ operator()() [3/3]

size_t Ocean::Rendering::TriangleFace::operator() ( const Rendering::TriangleFace triangleFace) const
inline

Hash function for a TriangleFace object.

Parameters
triangleFaceThe triangle face for which the hash will be determined
Returns
The resulting hash value

◆ operator==()

bool Ocean::Rendering::TriangleFace::operator== ( const TriangleFace triangleFace) const
inline

Returns whether two triangle face objects are identical.

Parameters
triangleFaceThe second object to compare
Returns
True, if so

◆ operator[]() [1/2]

VertexIndex & Ocean::Rendering::TriangleFace::operator[] ( const unsigned int  index)
inline

Returns a specific vertex index specified by it's index inside the face.

Beware: No range check will be done!

Parameters
indexIndex of the vertex index with range [0, 2]
Returns
Specified vertex index

◆ operator[]() [2/2]

VertexIndex Ocean::Rendering::TriangleFace::operator[] ( const unsigned int  index) const
inline

Returns a specific vertex index specified by it's index inside the face.

Beware: No range check will be done!

Parameters
indexIndex of the vertex index with range [0, 2]
Returns
Specified vertex index

Field Documentation

◆ indices_

VertexIndex Ocean::Rendering::TriangleFace::indices_[3]
protected

The three vertex indices.


The documentation for this class was generated from the following file: