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

Generic capsule shape with a center line segment and radius in N-dimensional space. More...

#include <GREM/core/geometry.hpp>

Public Types

using Component = T
 Scalar coordinate component type.

Public Member Functions

template<typename U>
GREM_ALWAYS_INLINE constexpr operator Capsule< N, U > () const noexcept
 Convert this capsule to an equivalent capsule of another scalar type.
bool operator== (const Capsule &other) const =default
 Compare this capsule to another for equality.
constexpr bool contains (const Point< N, T > &point) const noexcept
 Check if a given point is contained within the extents of this capsule.
constexpr Box< N, T > getBoundingBox () const noexcept
 Get the axis-aligned bounding box of the capsule.

Public Attributes

LineSegment< N, T > centerLine
 Center line of the capsule.
T radius
 Radius of the capsule from the center line.

Static Public Attributes

static constexpr size_t RANK = N
 Number of dimensions of the vector space.

Detailed Description

template<size_t N, typename T>
struct grem::Capsule< N, T >

Generic capsule shape with a center line segment and radius in N-dimensional space.

Template Parameters
Nnumber of vector dimensions.
Tscalar coordinate component type.

Member Typedef Documentation

◆ Component

template<size_t N, typename T>
using grem::Capsule< N, T >::Component = T

Scalar coordinate component type.

Member Function Documentation

◆ operator Capsule< N, U >()

template<size_t N, typename T>
template<typename U>
GREM_ALWAYS_INLINE constexpr grem::Capsule< N, T >::operator Capsule< N, U > ( ) const
inlineexplicitconstexprnoexcept

Convert this capsule to an equivalent capsule of another scalar type.

Returns
the converted capsule.

◆ operator==()

template<size_t N, typename T>
bool grem::Capsule< N, T >::operator== ( const Capsule< N, T > & other) const
nodiscarddefault

Compare this capsule to another for equality.

Parameters
otherthe capsule to compare this capsule to.
Returns
true if the capsules are equal, false otherwise.

◆ contains()

template<size_t N, typename T>
bool grem::Capsule< N, T >::contains ( const Point< N, T > & point) const
nodiscardconstexprnoexcept

Check if a given point is contained within the extents of this capsule.

Parameters
pointpoint to check.
Returns
true if the capsule contains the given point, false otherwise.

◆ getBoundingBox()

template<size_t N, typename T>
Box< N, T > grem::Capsule< N, T >::getBoundingBox ( ) const
inlinenodiscardconstexprnoexcept

Get the axis-aligned bounding box of the capsule.

Returns
an axis-aligned box that contains the entire capsule.

Member Data Documentation

◆ RANK

template<size_t N, typename T>
size_t grem::Capsule< N, T >::RANK = N
staticconstexpr

Number of dimensions of the vector space.

◆ centerLine

template<size_t N, typename T>
LineSegment<N, T> grem::Capsule< N, T >::centerLine

Center line of the capsule.

◆ radius

template<size_t N, typename T>
T grem::Capsule< N, T >::radius

Radius of the capsule from the center line.


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