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

Convex polytope. More...

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

Public Types

using Vertex = ConvexPolytopeVertex<N, Scalar>
 Vertex type of the convex polytope.
using Edge = ConvexPolytopeEdge<N, Scalar>
 Edge type of the convex polytope.
using Face = ConvexPolytopeFace<N, Scalar>
 Face type of the convex polytope.

Public Member Functions

 ConvexPolytope (Allocation< Vertex > vertices, Allocation< Face > faces, const Box< 2, Scalar > &boundingBox, Scalar boundingRadius)
 Construct a convex polygon from pre-calculated data.
 ConvexPolytope (Allocation< Vertex > vertices, Allocation< ConvexPolytopeEdgeIndex > vertexEdgeIndices, Allocation< Edge > edges, Allocation< Face > faces, const Box< 3, Scalar > &boundingBox, Scalar boundingRadius)
 Construct a convex polyhedron from pre-calculated data.
 ConvexPolytope (Span< const Vertex > vertices, const mat< N+1, N+1, Scalar > &transformation, ConvexPolytopeVertexIndex maxVertexCount=Limits< ConvexPolytopeVertexIndex >::MAX)
 Construct a convex polytope from the convex hull of a set of vertices.
 ConvexPolytope (Span< const Vertex > vertices, ConvexPolytopeVertexIndex maxVertexCount=Limits< ConvexPolytopeVertexIndex >::MAX)
 Construct a convex polytope from a set of vertices.
Span< const Vertex > getVertices () const noexcept
 Get the vertices of the convex polytope.
Span< const ConvexPolytopeEdgeIndex > getVertexEdgeIndices () const noexcept
 Get the vertex edge indices of the convex polytope.
Span< const Edge > getEdges () const noexcept
 Get the edges of the convex polytope.
Span< const Face > getFaces () const noexcept
 Get the faces of the convex polytope.
Box< N, Scalar > getBoundingBox () const noexcept
 Get the bounding box of the convex polytope.
Scalar getBoundingRadius () const noexcept
 Get the bounding radius of the convex polytope.

Detailed Description

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

Convex polytope.

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::ConvexPolytope< N, Scalar >::Vertex = ConvexPolytopeVertex<N, Scalar>

Vertex type of the convex polytope.

◆ Edge

template<size_t N, typename Scalar>
using grem::ConvexPolytope< N, Scalar >::Edge = ConvexPolytopeEdge<N, Scalar>

Edge type of the convex polytope.

◆ Face

template<size_t N, typename Scalar>
using grem::ConvexPolytope< N, Scalar >::Face = ConvexPolytopeFace<N, Scalar>

Face type of the convex polytope.

Constructor & Destructor Documentation

◆ ConvexPolytope() [1/4]

template<size_t N, typename Scalar>
grem::ConvexPolytope< N, Scalar >::ConvexPolytope ( Allocation< Vertex > vertices,
Allocation< Face > faces,
const Box< 2, Scalar > & boundingBox,
Scalar boundingRadius )
inline

Construct a convex polygon from pre-calculated data.

Parameters
verticesvertices of the convex polyhedron.
facesfaces of the convex polygon. Must form a valid convex polygon with the given vertices.
boundingBoxlocal bounding box of the convex polygon. Must contain all of the given vertices.
boundingRadiusmaximum distance from the origin of any vertex. Must be greater than or equal to the largest vertex vector length.
Exceptions
std::bad_allocon allocation failure.

◆ ConvexPolytope() [2/4]

template<size_t N, typename Scalar>
grem::ConvexPolytope< N, Scalar >::ConvexPolytope ( Allocation< Vertex > vertices,
Allocation< ConvexPolytopeEdgeIndex > vertexEdgeIndices,
Allocation< Edge > edges,
Allocation< Face > faces,
const Box< 3, Scalar > & boundingBox,
Scalar boundingRadius )
inline

Construct a convex polyhedron from pre-calculated data.

Parameters
verticesvertices of the convex polyhedron.
vertexEdgeIndicesoutgoing edges corresponding to each vertex. Must have the same size as the vertex array.
edgesedges of the convex polyhedron. Must form a valid convex polyhedron with the given vertices and faces.
facesfaces of the convex polyhedron. Must form a valid convex polyhedron with the given vertices and edges.
boundingBoxlocal bounding box of the convex polygon. Must contain all of the given vertices.
boundingRadiusmaximum distance from the origin of any vertex. Must be greater than or equal to the largest vertex vector length.

◆ ConvexPolytope() [3/4]

template<size_t N, typename Scalar>
grem::ConvexPolytope< N, Scalar >::ConvexPolytope ( Span< const Vertex > vertices,
const mat< N+1, N+1, Scalar > & transformation,
ConvexPolytopeVertexIndex maxVertexCount = Limits<ConvexPolytopeVertexIndex>::MAX )
inline

Construct a convex polytope from the convex hull of a set of vertices.

Parameters
verticesset of vertices to construct the convex polytope from.
transformationtransformation to apply to the vertices when building the convex hull.
maxVertexCountmaximum number of vertices to build the convex hull out of.
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.

◆ ConvexPolytope() [4/4]

template<size_t N, typename Scalar>
grem::ConvexPolytope< N, Scalar >::ConvexPolytope ( Span< const Vertex > vertices,
ConvexPolytopeVertexIndex maxVertexCount = Limits<ConvexPolytopeVertexIndex>::MAX )
inlineexplicit

Construct a convex polytope from a set of vertices.

Parameters
verticesset of vertices to construct the convex polytope from.
maxVertexCountmaximum number of vertices to build the convex hull out of.
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::ConvexPolytope< N, Scalar >::getVertices ( ) const
inlinenodiscardnoexcept

Get the vertices of the convex polytope.

Returns
the vertices of the convex polytope.

◆ getVertexEdgeIndices()

template<size_t N, typename Scalar>
Span< const ConvexPolytopeEdgeIndex > grem::ConvexPolytope< N, Scalar >::getVertexEdgeIndices ( ) const
inlinenodiscardnoexcept

Get the vertex edge indices of the convex polytope.

Returns
the outgoing edge indices corresponding to each vertex.

◆ getEdges()

template<size_t N, typename Scalar>
Span< const Edge > grem::ConvexPolytope< N, Scalar >::getEdges ( ) const
inlinenodiscardnoexcept

Get the edges of the convex polytope.

Returns
the edges of the convex polytope.

◆ getFaces()

template<size_t N, typename Scalar>
Span< const Face > grem::ConvexPolytope< N, Scalar >::getFaces ( ) const
inlinenodiscardnoexcept

Get the faces of the convex polytope.

Returns
the faces of the convex polytope.

◆ getBoundingBox()

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

Get the bounding box of the convex polytope.

Returns
a local axis-aligned bounding box that contains all vertices in the convex polytope.

◆ getBoundingRadius()

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

Get the bounding radius of the convex polytope.

Returns
the bounding radius of the convex polytope.

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