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

Result of a raycast hit. More...

#include <GREM/physics/Shape.hpp>

Public Types

using Unit = typename Position<N>::Unit
 Unit type.
using DimensionType = typename Unit::DimensionType
 Unit dimension type.
using MagnitudeType = typename Unit::MagnitudeType
 Unit magnitude type.

Public Member Functions

template<typename OtherUnitT>
requires (OtherUnitT::DIMENSION == LENGTH)
GREM_ALWAYS_INLINE constexpr grem::RayHit< N, Scalar > in (OtherUnitT unit) const noexcept
 Convert this physical ray hit to a unitless ray hit given a desired unit.

Static Public Member Functions

template<typename T>
static GREM_ALWAYS_INLINE constexpr RayHit reinterpret (const grem::RayHit< N, T > &hit) noexcept
 Reinterpret a unitless ray hit as a physical ray hit in default units.

Public Attributes

Length< N > localOffset
 Offset from the object's center of mass in shape-local space at which the hit occured.
Distance distance
 Distance from the ray origin, along the ray direction, at which the hit occured.
Direction< N > normal
 Unit normal vector of the surface that was hit.

Static Public Attributes

static constexpr Unit UNIT {}
 Unit.
static constexpr DimensionType DIMENSION {}
 Unit dimension.
static constexpr MagnitudeType MAGNITUDE {}
 Unit magnitude.

Detailed Description

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

Result of a raycast hit.

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

Member Typedef Documentation

◆ Unit

template<size_t N>
using grem::physics::RayHit< N >::Unit = typename Position<N>::Unit

Unit type.

◆ DimensionType

template<size_t N>
using grem::physics::RayHit< N >::DimensionType = typename Unit::DimensionType

Unit dimension type.

◆ MagnitudeType

template<size_t N>
using grem::physics::RayHit< N >::MagnitudeType = typename Unit::MagnitudeType

Unit magnitude type.

Member Function Documentation

◆ reinterpret()

template<size_t N>
template<typename T>
GREM_ALWAYS_INLINE constexpr RayHit grem::physics::RayHit< N >::reinterpret ( const grem::RayHit< N, T > & hit)
inlinestaticnodiscardconstexprnoexcept

Reinterpret a unitless ray hit as a physical ray hit in default units.

Parameters
hitray hit to reinterpret.
Returns
the corresponding physical ray hit.

◆ in()

template<size_t N>
template<typename OtherUnitT>
requires (OtherUnitT::DIMENSION == LENGTH)
GREM_ALWAYS_INLINE constexpr grem::RayHit< N, Scalar > grem::physics::RayHit< N >::in ( OtherUnitT unit) const
inlinenodiscardconstexprnoexcept

Convert this physical ray hit to a unitless ray hit given a desired unit.

Parameters
unitunit to get the ray hit in.
Returns
the corresponding ray hit in the given unit.

Member Data Documentation

◆ UNIT

template<size_t N>
Unit grem::physics::RayHit< N >::UNIT {}
staticconstexpr

Unit.

◆ DIMENSION

template<size_t N>
DimensionType grem::physics::RayHit< N >::DIMENSION {}
staticconstexpr

Unit dimension.

◆ MAGNITUDE

template<size_t N>
MagnitudeType grem::physics::RayHit< N >::MAGNITUDE {}
staticconstexpr

Unit magnitude.

◆ localOffset

template<size_t N>
Length<N> grem::physics::RayHit< N >::localOffset

Offset from the object's center of mass in shape-local space at which the hit occured.

◆ distance

template<size_t N>
Distance grem::physics::RayHit< N >::distance

Distance from the ray origin, along the ray direction, at which the hit occured.

◆ normal

template<size_t N>
Direction<N> grem::physics::RayHit< N >::normal

Unit normal vector of the surface that was hit.


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