|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Shape in 3-dimensional space. More...
#include <GREM/physics/Shape.hpp>

Public Types | |
| using | value_type = Variant |
| Public Types inherited from grem::Variant< PointShape3D, LineSegmentShape3D, InfiniteLineShape3D, InfiniteHalfSpaceShape3D, InfinitePlaneShape3D, BoxShape3D, CubeShape3D, EllipsoidShape3D, SphereShape3D, CapsuleShape3D, TaperedCapsuleShape3D, CylinderShape3D, TaperedCylinderShape3D, ConvexPolytopeShape3D, TriangleMeshShape3D, LocallyTransformedShape3D, CompoundColliderShape3D > | |
| using | index_type |
| Index type used to encode the active alternative type. | |
Public Member Functions | |
| bool | isConvexShapeType () const |
| Check if the shape held by this wrapper is a convex shape type. | |
| bool | isConvexPolytopeShapeType () const |
| 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. | |
| PrincipalMomentsOfInertia3D | calculatePrincipalMomentsOfInertia (Mass mass) const |
| Calculate an estimate of the local moment of inertia of the shape given a certain mass. | |
| Optional< Box3D > | getBoundingBox (const Transformation3D &transformation) const |
| Get the axis-aligned bounding box of the shape given its position and orientation in the world. | |
| Optional< Distance > | getBoundingRadius (const Basis3D &basis) const |
| Get the radius of the bounding sphere of the shape. | |
| Optional< Area > | getReferenceArea (const Basis3D &basis, Direction3D 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. | |
| RaycastResult3D | castLocalRay (Length3D localRayOrigin, Direction3D localRayDirection, Distance maxLocalRayDistance) const |
| Find the closest intersection of this shape with a given ray in local space. | |
| constexpr | Variant () noexcept(std::is_nothrow_default_constructible_v< variant_alternative_t< 0, Variant > >) |
| Default-construct a variant with the first variant alternative, if it is default-constructible. | |
| template<typename U> requires (!std::is_same_v<std::remove_cvref_t<U>, Variant> && variant_has_alternative_v<decltype(F(std::forward<U>(value))), Variant> && std::is_constructible_v<decltype(F(std::forward<U>(value))), U>) | |
| constexpr | Variant (U &&value) noexcept(std::is_nothrow_constructible_v< decltype(F(std::forward< U >(value))), U >) |
| Converting constructor. | |
| template<typename T, typename... Args> requires (variant_has_alternative_v<T, Variant> && std::is_constructible_v<T, Args...>) | |
| constexpr | Variant (std::in_place_type_t< T > type, Args &&... args) |
| Construct a variant alternative in-place given its type. | |
| template<typename T, typename U, typename... Args> requires (variant_has_alternative_v<T, Variant> && std::is_constructible_v<T, std::initializer_list<U>&, Args...>) | |
| constexpr | Variant (std::in_place_type_t< T > type, std::initializer_list< U > ilist, Args &&... args) |
| Construct a variant alternative in-place given its type, with an initializer list as the first constructor argument. | |
| template<std::size_t Index, typename... Args> requires (Index < sizeof...(Ts) && std::is_constructible_v<variant_alternative_t<Index, Variant>, Args...>) | |
| constexpr | Variant (std::in_place_index_t< Index > index, Args &&... args) |
| Construct a variant alternative in-place given its index. | |
| template<std::size_t Index, typename U, typename... Args> requires (Index < sizeof...(Ts) && std::is_constructible_v<variant_alternative_t<Index, Variant>, std::initializer_list<U>&, Args...>) | |
| constexpr | Variant (std::in_place_index_t< Index > index, std::initializer_list< U > ilist, Args &&... args) |
| Construct a variant alternative in-place given its index, with an initializer list as the first constructor argument. | |
| constexpr | Variant (const Variant &other)=delete |
| Deleted copy constructor. | |
| constexpr | Variant (Variant &&other) noexcept=default |
| Trivial move constructor. | |
| Public Member Functions inherited from grem::Variant< PointShape3D, LineSegmentShape3D, InfiniteLineShape3D, InfiniteHalfSpaceShape3D, InfinitePlaneShape3D, BoxShape3D, CubeShape3D, EllipsoidShape3D, SphereShape3D, CapsuleShape3D, TaperedCapsuleShape3D, CylinderShape3D, TaperedCylinderShape3D, ConvexPolytopeShape3D, TriangleMeshShape3D, LocallyTransformedShape3D, CompoundColliderShape3D > | |
| constexpr | ~Variant () |
| Destructor. | |
| constexpr Variant & | operator= (const Variant &other)=delete |
| Deleted copy assignment. | |
| constexpr T & | emplace (Args &&... args) |
| Construct an alternative given its type, destroying the old value. | |
| constexpr void | swap (Variant &other) noexcept(((std::is_nothrow_move_constructible_v< Ts > &&std::is_nothrow_swappable_v< Ts >) &&...)) |
| Swap this variant's value with that of another. | |
| constexpr index_type | index () const noexcept |
| Get the alternative index of the currently active value held by the variant. | |
| constexpr bool | valueless_by_exception () const noexcept |
| Check if the variant is in the valueless by exception state. | |
| constexpr bool | is () const noexcept |
| Check if the variant currently holds the alternative with the given type. | |
| constexpr T & | as () &noexcept |
| Access the underlying value with the given type without a safety check. | |
| constexpr T & | get () & |
| Access the underlying value with the given type. | |
| constexpr T * | get_if () noexcept |
| Access the underlying value with the given type if it is the currently active alternative. | |
Shape in 3-dimensional space.
| using grem::physics::Shape< 3 >::value_type = Variant |
|
inlinenodiscard |
Check if the shape held by this wrapper is a convex shape type.
|
inlinenodiscard |
Check if the shape held by this wrapper is a convex polytope shape type.
|
inlinenodiscard |
Calculate an estimate of the volume of the shape.
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlineconstexprnoexcept |
Default-construct a variant with the first variant alternative, if it is default-constructible.
| any | exception thrown by the underlying constructor of the first alternative type. |
|
inlineconstexprnoexcept |
Converting constructor.
Chooses the variant alternative type to construct based on the overloading rules specified by std::variant.
| value | underlying value to construct the variant from. Must be convertible to one of the variant's listed alternative types. |
| any | exception thrown by the underlying constructor of the relevant alternative type. |
|
inlineexplicitconstexpr |
Construct a variant alternative in-place given its type.
| type | std::in_place_type<T>, where T is the alternative type to construct, which must be one of the variant's listed alternative types. |
| args | arguments to pass to the underlying value's constructor. |
| any | exception thrown by the underlying constructor of the relevant alternative type. |
|
inlineexplicitconstexpr |
Construct a variant alternative in-place given its type, with an initializer list as the first constructor argument.
| type | std::in_place_type<T>, where T is the alternative type to construct, which must be one of the variant's listed alternative types. |
| ilist | first argument to pass to the underlying value's constructor. |
| args | subsequent arguments to pass to the underlying value's constructor. |
| any | exception thrown by the underlying constructor of the relevant alternative type. |
|
inlineexplicitconstexpr |
Construct a variant alternative in-place given its index.
| index | std::in_place_index<Index>, where Index is the alternative index to construct, which must be within the range of the variant's list of alternative types. |
| args | arguments to pass to the underlying value's constructor. |
| any | exception thrown by the underlying constructor of the relevant alternative type. |
|
inlineexplicitconstexpr |
Construct a variant alternative in-place given its index, with an initializer list as the first constructor argument.
| index | std::in_place_index<Index>, where Index is the alternative index to construct, which must be within the range of the variant's list of alternative types. |
| ilist | first argument to pass to the underlying value's constructor. |
| args | subsequent arguments to pass to the underlying value's constructor. |
| any | exception thrown by the underlying constructor of the relevant alternative type. |
|
constexprdelete |
Deleted copy constructor.
|
constexprdefaultnoexcept |
Trivial move constructor.