GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::TriangleMesh< N, Scalar > Class Template Reference

Triangle mesh. More...

#include <GREM/core/data/TriangleMesh.hpp>

Public Types

using Vertex = TriangleMeshVertex<N, Scalar>
 Vertex type of the triangle mesh.
using VertexIndex = TriangleMeshVertexIndex
 Vertex index type of the triangle mesh.
using FaceIndex = TriangleMeshFaceIndex
 Face index type of the triangle mesh.

Public Member Functions

 TriangleMesh (Allocation< Vertex > vertices, Allocation< VertexIndex > indices)
 Construct a triangle mesh from a set of vertices.
 TriangleMesh (Span< const Vertex > vertices, Span< const VertexIndex > indices)
 Construct a triangle mesh from a set of vertices and indices.
Span< const Vertex > getVertices () const noexcept
 Get the vertices of the mesh.
Span< const VertexIndex > getIndices () const noexcept
 Get the vertex indices of the mesh.
Box< N, Scalar > getBoundingBox () const noexcept
 Get the bounding box of the mesh.
Scalar getBoundingRadius () const noexcept
 Get the bounding radius of the mesh.
const LooseOrthtree< N, Scalar, FaceIndex > & getFaceOrthtree () const noexcept
 Get the orthtree of faces in the mesh.

Detailed Description

template<size_t N, typename Scalar>
class grem::TriangleMesh< N, Scalar >

Triangle mesh.

Template Parameters
Nnumber of dimensions of the world space (must be 2 or 3).
Scalarscalar coordinate component type.

Member Typedef Documentation

◆ Vertex

template<size_t N, typename Scalar>
using grem::TriangleMesh< N, Scalar >::Vertex = TriangleMeshVertex<N, Scalar>

Vertex type of the triangle mesh.

◆ VertexIndex

template<size_t N, typename Scalar>
using grem::TriangleMesh< N, Scalar >::VertexIndex = TriangleMeshVertexIndex

Vertex index type of the triangle mesh.

◆ FaceIndex

template<size_t N, typename Scalar>
using grem::TriangleMesh< N, Scalar >::FaceIndex = TriangleMeshFaceIndex

Face index type of the triangle mesh.

Constructor & Destructor Documentation

◆ TriangleMesh() [1/2]

template<size_t N, typename Scalar>
grem::TriangleMesh< N, Scalar >::TriangleMesh ( Allocation< Vertex > vertices,
Allocation< VertexIndex > indices )
inline

Construct a triangle mesh from a set of vertices.

Parameters
verticesset of vertices to construct the triangle mesh from.
indicesset of vertex indices to construct the triangle mesh from. Each index must be less than the number of vertices. Size must be a multiple of 3.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ TriangleMesh() [2/2]

template<size_t N, typename Scalar>
grem::TriangleMesh< N, Scalar >::TriangleMesh ( Span< const Vertex > vertices,
Span< const VertexIndex > indices )
inline

Construct a triangle mesh from a set of vertices and indices.

Parameters
verticesread-only view over a set of vertices to construct the triangle mesh from.
indicesread-only view over a set of vertex indices to construct the triangle mesh from. Each index must be less than the number of vertices. Size must be a multiple of 3.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

Member Function Documentation

◆ getVertices()

template<size_t N, typename Scalar>
Span< const Vertex > grem::TriangleMesh< N, Scalar >::getVertices ( ) const
inlinenodiscardnoexcept

Get the vertices of the mesh.

Returns
a read-only view over the vertices of the mesh.

◆ getIndices()

template<size_t N, typename Scalar>
Span< const VertexIndex > grem::TriangleMesh< N, Scalar >::getIndices ( ) const
inlinenodiscardnoexcept

Get the vertex indices of the mesh.

Returns
a read-only view over the indices of the mesh, defining triangles in sets of 3, with counter-clockwise winding order. Its size must be a multiple of 3, and each index must be less than the number of vertices in the mesh.

◆ getBoundingBox()

template<size_t N, typename Scalar>
Box< N, Scalar > grem::TriangleMesh< N, Scalar >::getBoundingBox ( ) const
inlinenodiscardnoexcept

Get the bounding box of the mesh.

Returns
a local axis-aligned bounding box that contains all vertices in the triangle mesh.

◆ getBoundingRadius()

template<size_t N, typename Scalar>
Scalar grem::TriangleMesh< N, Scalar >::getBoundingRadius ( ) const
inlinenodiscardnoexcept

Get the bounding radius of the mesh.

Returns
the bounding radius of the triangle mesh.

◆ getFaceOrthtree()

template<size_t N, typename Scalar>
const LooseOrthtree< N, Scalar, FaceIndex > & grem::TriangleMesh< N, Scalar >::getFaceOrthtree ( ) const
inlinenodiscardnoexcept

Get the orthtree of faces in the mesh.

Returns
a loose orthtree structure for accelerating intersection queries against the faces (triangles) of the mesh, that stores face indices, which are equal to the indices of the first corresponding vertex indices divided by 3.

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