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

Result of a raycast. More...

#include <GREM/physics/Shape.hpp>

Inheritance diagram for grem::physics::RaycastResult< N >:

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 Types inherited from grem::Variant< RayMiss, RayHit< N >, RayHitInterior< N > >
using index_type
 Index type used to encode the active alternative type.

Public Member Functions

template<typename OtherUnitT>
requires (OtherUnitT::DIMENSION == LENGTH)
GREM_ALWAYS_INLINE constexpr grem::RaycastResult< N, Scalar > in (OtherUnitT unit) const
 Convert this physical raycast result to a unitless raycast result given a desired unit.
Public Member Functions inherited from grem::Variant< RayMiss, RayHit< N >, RayHitInterior< N > >
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.

Static Public Member Functions

template<typename T>
static GREM_ALWAYS_INLINE constexpr RaycastResult reinterpret (const grem::RaycastResult< N, T > &raycastResult) noexcept
 Reinterpret a unitless raycast result as a physical raycast result in default units.
Static Public Member Functions inherited from grem::Variant< RayMiss, RayHit< N >, RayHitInterior< N > >
static constexpr decltype(auto) visit (Visitor &&visitor, V &&variant)
 Call a visitor functor with the currently active underlying value of a variant.
static constexpr decltype(auto) visitIndex (index_type index, Visitor &&visitor)
 Call a visitor functor with the type corresponding to a variant index.
static constexpr decltype(auto) apply (Function &&function)
 Call a functor with all alternative types.

Static Public Attributes

static constexpr Unit UNIT {}
 Unit.
static constexpr DimensionType DIMENSION {}
 Unit dimension.
static constexpr MagnitudeType MAGNITUDE {}
 Unit magnitude.
Static Public Attributes inherited from grem::Variant< RayMiss, RayHit< N >, RayHitInterior< N > >
static constexpr index_type npos
 Invalid alternative index, representing the valueless by exception state.

Detailed Description

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

Result of a raycast.

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::RaycastResult< N >::Unit = typename Position<N>::Unit

Unit type.

◆ DimensionType

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

Unit dimension type.

◆ MagnitudeType

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

Unit magnitude type.

Member Function Documentation

◆ reinterpret()

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

Reinterpret a unitless raycast result as a physical raycast result in default units.

Parameters
raycastResultraycast result to reinterpret.
Returns
the corresponding physical raycast result.

◆ in()

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

Convert this physical raycast result to a unitless raycast result given a desired unit.

Parameters
unitunit to get the raycast result in.
Returns
the corresponding raycast result in the given unit.

Member Data Documentation

◆ UNIT

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

Unit.

◆ DIMENSION

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

Unit dimension.

◆ MAGNITUDE

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

Unit magnitude.


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