GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::physics::InfiniteLineShape< N > Struct Template Reference

Infinite line shape parallel to the local Y axis. More...

#include <GREM/physics/Shape.hpp>

Public Member Functions

GREM_ALWAYS_INLINE Volume calculateVolume () const
 Calculate an estimate of the volume of the shape.
GREM_ALWAYS_INLINE 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.
GREM_ALWAYS_INLINE 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.
GREM_ALWAYS_INLINE 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.
GREM_ALWAYS_INLINE bool containsLocalPoint (Length< N > localPoint) const
 Check if a local point relative to the origin of the shape is contained within the shape.
GREM_ALWAYS_INLINE Length< N > getLocalSupportPointOffset (Direction< N > localDirection) const
 Get the local offset from the origin of the shape to the farthest point on the shape in a certain local direction.

Detailed Description

template<size_t N>
struct grem::physics::InfiniteLineShape< N >

Infinite line shape parallel to the local Y axis.

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

Member Function Documentation

◆ calculateVolume()

template<size_t N>
GREM_ALWAYS_INLINE Volume grem::physics::InfiniteLineShape< N >::calculateVolume ( ) const
inlinenodiscard

Calculate an estimate of the volume of the shape.

Returns
the estimated volume of the shape.

◆ calculatePrincipalMomentsOfInertia()

template<size_t N>
GREM_ALWAYS_INLINE PrincipalMomentsOfInertia< N > grem::physics::InfiniteLineShape< N >::calculatePrincipalMomentsOfInertia ( Mass mass) const
inlinenodiscard

Calculate an estimate of the local moment of inertia of the shape given a certain mass.

Parameters
massassumed mass of the shape.
Returns
the estimated moment of inertia in shape-local space.

◆ getBoundingBox()

template<size_t N>
GREM_ALWAYS_INLINE Optional< Box< N > > grem::physics::InfiniteLineShape< N >::getBoundingBox ( const Transformation< N > & transformation) const
inlinenodiscard

Get the axis-aligned bounding box of the shape given its position and orientation in the world.

Parameters
transformationtransformation of the shape in world space.
Returns
an axis-aligned bounding box in world space that would contain the entire shape if the shape was at the given position and orientation in the world, or an empty optional if the shape extends infinitely and cannot be fit inside a finite box.

◆ getBoundingRadius()

template<size_t N>
GREM_ALWAYS_INLINE Optional< Distance > grem::physics::InfiniteLineShape< N >::getBoundingRadius ( const Basis< N > & basis) const
inlinenodiscard

Get the radius of the bounding sphere of the shape.

Parameters
basistransformation basis of the shape in world space.
Returns
the maximum distance from the origin of any point on the shape, or an empty optional if the shape extends infinitely and cannot be fit inside a finite sphere.

◆ getReferenceArea()

template<size_t N>
GREM_ALWAYS_INLINE Optional< Area > grem::physics::InfiniteLineShape< N >::getReferenceArea ( const Basis< N > & basis,
Direction< N > direction ) const
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.

Parameters
basistransformation basis of the shape in world space.
directiondirection to get the reference area for.
Returns
the reference area, or an empty optional if an area cannot be determined, e.g. because the shape is infinite.

◆ castLocalRay()

template<size_t N>
GREM_ALWAYS_INLINE RaycastResult< N > grem::physics::InfiniteLineShape< N >::castLocalRay ( Length< N > localRayOrigin,
Direction< N > localRayDirection,
Distance maxLocalRayDistance ) const
inlinenodiscard

Find the closest intersection of this shape with a given ray in local space.

Parameters
localRayOriginoffset of the ray origin in shape-local space.
localRayDirectionunit direction vector of the ray in shape-local space. Must be a unit vector.
maxLocalRayDistancemaximum hit distance of the ray in shape-local space. Must be non-negative.
Returns
the result of the raycast.

◆ containsLocalPoint()

template<size_t N>
GREM_ALWAYS_INLINE bool grem::physics::InfiniteLineShape< N >::containsLocalPoint ( Length< N > localPoint) const
inlinenodiscard

Check if a local point relative to the origin of the shape is contained within the shape.

Parameters
localPointpoint in shape-local space to check.
Returns
true if the shape contains the given point, false otherwise.
Exceptions
BadVariantAccessif the underlying shape type is not convex.

◆ getLocalSupportPointOffset()

template<size_t N>
GREM_ALWAYS_INLINE Length< N > grem::physics::InfiniteLineShape< N >::getLocalSupportPointOffset ( Direction< N > localDirection) const
inlinenodiscard

Get the local offset from the origin of the shape to the farthest point on the shape in a certain local direction.

Parameters
localDirectionunit vector in shape-local space of the direction to evaluate. Must be a unit vector.
Returns
a relative vector from the origin of the shape to the farthest point on the shape in the given direction, in shape-local space.
Exceptions
BadVariantAccessif the underlying shape type is not convex.

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