|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Triangle mesh shape. More...
#include <GREM/physics/Shape.hpp>
Public Types | |
| using | Vertex = typename TriangleMesh<N, float>::Vertex |
| Vertex type of the triangle mesh shape. | |
| using | VertexIndex = typename TriangleMesh<N, float>::VertexIndex |
| Vertex index type of the triangle mesh shape. | |
| using | FaceIndex = typename TriangleMesh<N, float>::FaceIndex |
| Face index type of the triangle mesh shape. | |
Public Member Functions | |
| GREM_ALWAYS_INLINE | TriangleMeshShape (SharedPointer< TriangleMesh< N, float > > mesh) noexcept |
| Construct a triangle mesh shape from an existing triangle mesh. | |
| TriangleMeshShape (Allocation< Vertex > vertices, Allocation< VertexIndex > indices) | |
| Construct a triangle mesh shape from a set of vertices. | |
| TriangleMeshShape (Span< const Vertex > vertices, Span< const VertexIndex > indices) | |
| Construct a triangle mesh shape from a set of vertices and indices. | |
| GREM_ALWAYS_INLINE const SharedPointer< TriangleMesh< N, float > > & | getTriangleMesh () const noexcept |
| Get the underlying triangle mesh of the shape. | |
| Volume | calculateVolume () const |
| Calculate an estimate of the volume of the shape. | |
| PrincipalMomentsOfInertia< N > | calculatePrincipalMomentsOfInertia (Mass mass) const |
| Calculate an estimate of the local moment of inertia of the shape given a certain mass. | |
| GREM_ALWAYS_INLINE Optional< Box< N > > | getBoundingBox (const Transformation< N > &transformation) const |
| Get the axis-aligned bounding box of the shape given its position and orientation in the world. | |
| GREM_ALWAYS_INLINE Optional< Distance > | getBoundingRadius (const Basis< N > &basis) const |
| Get the radius of the bounding sphere of the shape. | |
| Optional< Area > | getReferenceArea (const Basis< N > &basis, Direction< N > direction) const |
| Get an estimate of the reference area of the shape for a certain direction, typically calculated as the area of the largest cross section orthogonal to the given direction. | |
| RaycastResult< N > | castLocalRay (Length< N > localRayOrigin, Direction< N > localRayDirection, Distance maxLocalRayDistance) const |
| Find the closest intersection of this shape with a given ray in local space. | |
Triangle mesh shape.
| N | number of dimensions of the world space (must be 2 or 3). |
| using grem::physics::TriangleMeshShape< N >::Vertex = typename TriangleMesh<N, float>::Vertex |
Vertex type of the triangle mesh shape.
| using grem::physics::TriangleMeshShape< N >::VertexIndex = typename TriangleMesh<N, float>::VertexIndex |
Vertex index type of the triangle mesh shape.
| using grem::physics::TriangleMeshShape< N >::FaceIndex = typename TriangleMesh<N, float>::FaceIndex |
Face index type of the triangle mesh shape.
|
inlineexplicitnoexcept |
Construct a triangle mesh shape from an existing triangle mesh.
| mesh | shared pointer to the mesh. Must not be nullptr. |
| grem::physics::TriangleMeshShape< N >::TriangleMeshShape | ( | Allocation< Vertex > | vertices, |
| Allocation< VertexIndex > | indices ) |
Construct a triangle mesh shape from a set of vertices.
| vertices | set of vertices to construct the triangle mesh from. |
| indices | 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. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| grem::physics::TriangleMeshShape< N >::TriangleMeshShape | ( | Span< const Vertex > | vertices, |
| Span< const VertexIndex > | indices ) |
Construct a triangle mesh shape from a set of vertices and indices.
| vertices | read-only view over a set of vertices to construct the triangle mesh from. |
| indices | read-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. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscardnoexcept |
Get the underlying triangle mesh of the shape.
|
nodiscard |
Calculate an estimate of the volume of the shape.
|
nodiscard |
Calculate an estimate of the local moment of inertia of the shape given a certain mass.
| mass | assumed mass of the shape. |
|
inlinenodiscard |
Get the axis-aligned bounding box of the shape given its position and orientation in the world.
| transformation | transformation of the shape in world space. |
|
inlinenodiscard |
Get the radius of the bounding sphere of the shape.
| basis | transformation basis of the shape in world space. |
|
nodiscard |
Get an estimate of the reference area of the shape for a certain direction, typically calculated as the area of the largest cross section orthogonal to the given direction.
| basis | transformation basis of the shape in world space. |
| direction | direction to get the reference area for. |
|
nodiscard |
Find the closest intersection of this shape with a given ray in local space.
| localRayOrigin | offset of the ray origin in shape-local space. |
| localRayDirection | unit direction vector of the ray in shape-local space. Must be a unit vector. |
| maxLocalRayDistance | maximum hit distance of the ray in shape-local space. Must be non-negative. |