|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
View of a generic shape. More...
#include <GREM/physics/Shape.hpp>

Public Types | |
| using | value_type = typename Shape<N>::value_type |
| Underling shape variant type. | |
| using | index_type = value_type::index_type |
| Index type used to encode the active shape type. | |
Public Member Functions | |
| template<typename T> requires (same_as<T, Shape<N>>) | |
| GREM_ALWAYS_INLINE constexpr | ShapeView (const T &shape) noexcept |
| Construct a shape view. | |
| template<typename T> requires (!same_as<T, Shape<N>> && variant_has_alternative_v<T, value_type>) | |
| GREM_ALWAYS_INLINE constexpr | ShapeView (const T &shape) noexcept |
| Construct a shape view. | |
| GREM_ALWAYS_INLINE constexpr const void * | data () const noexcept |
| Get an untyped pointer to the data of the underlying shape. | |
| GREM_ALWAYS_INLINE constexpr index_type | index () const noexcept |
| Get the type index of the underlying shape. | |
| constexpr bool | valueless_by_exception () const noexcept |
| Check if the shape view is in the valueless by exception state. | |
| template<typename T> requires (variant_has_alternative_v<T, value_type>) | |
| constexpr bool | is () const noexcept |
| Check if the shape view currently references the alternative with the given type. | |
| template<typename T> requires (variant_has_alternative_v<T, value_type>) | |
| constexpr const T & | as () const &noexcept |
| Access the underlying value with the given type without a safety check. | |
| template<typename T> requires (variant_has_alternative_v<T, value_type>) | |
| constexpr const T & | get () const & |
| Access the underlying value with the given type. | |
| template<typename T> requires (variant_has_alternative_v<T, value_type>) | |
| constexpr const T * | get_if () const noexcept |
| Access the underlying shape with the given type if it is the currently active alternative. | |
| bool | isConvexShapeType () const noexcept |
| Check if the shape held by this wrapper is a convex shape type. | |
| bool | isConvexPolytopeShapeType () const noexcept |
| Check if the shape held by this wrapper is a convex polytope shape type. | |
| 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. | |
| 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. | |
| 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. | |
View of a generic shape.
| N | number of dimensions of the world space (must be 2 or 3). |
| using grem::physics::ShapeView< N >::value_type = typename Shape<N>::value_type |
Underling shape variant type.
| using grem::physics::ShapeView< N >::index_type = value_type::index_type |
Index type used to encode the active shape type.
|
inlineconstexprnoexcept |
Construct a shape view.
| shape | reference to the shape to construct the view over. Must outlive its use in the view. |
|
inlineconstexprnoexcept |
Construct a shape view.
| shape | reference to the shape to construct the view over. Must outlive its use in the view. |
|
inlinenodiscardconstexprnoexcept |
Get an untyped pointer to the data of the underlying shape.
|
inlinenodiscardconstexprnoexcept |
Get the type index of the underlying shape.
|
inlinenodiscardconstexprnoexcept |
Check if the shape view is in the valueless by exception state.
|
inlinenodiscardconstexprnoexcept |
Check if the shape view currently references the alternative with the given type.
| T | alternative type to check for. Must be one of Shape<N>'s listed alternative types. |
|
inlinenodiscardconstexprnoexcept |
Access the underlying value with the given type without a safety check.
| T | type of the currently active value to get. Must be one of Shape<N>'s listed alternative types. |
|
inlinenodiscardconstexpr |
Access the underlying value with the given type.
| T | type of the currently active value to get. Must be one of Shape<N>'s listed alternative types. |
| BadVariantAccess | if the shape view does not currently reference a value of the given type. |
|
inlinenodiscardconstexprnoexcept |
Access the underlying shape with the given type if it is the currently active alternative.
| T | type of the value to get. Must be one of Shape<N>'s listed alternative types. |
|
nodiscardnoexcept |
Check if the shape held by this wrapper is a convex shape type.
|
nodiscardnoexcept |
Check if the shape held by this wrapper is a convex polytope shape type.
|
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. |
|
nodiscard |
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. |
|
nodiscard |
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. |