GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::physics::Dimension< Mass, Length, Time > Struct Template Reference

Physical dimension type template. More...

#include <GREM/physics/quantities.hpp>

Public Member Functions

consteval bool operator== (const Dimension &other) const noexcept
 Compare this dimension to another for equality.
template<int OtherMass, int OtherLength, int OtherTime>
consteval bool operator== (const Dimension< OtherMass, OtherLength, OtherTime > &other) const noexcept
 Compare this dimension to another for equality.
consteval auto operator+ () const
 Get the dimension resulting from taking the additive identity of a quantity of this dimension.
consteval auto operator- () const
 Get the dimension resulting from taking the additive inverse of a quantity of this dimension.
consteval auto operator+ (const Dimension &other) const
 Get the dimension resulting from adding a quantity of another dimension to a quantity of this dimension.
consteval auto operator- (const Dimension &other) const
 Get the dimension resulting from subtracting a quantity of another dimension from a quantity of this dimension.
template<int OtherMass, int OtherLength, int OtherTime>
consteval auto operator* (const Dimension< OtherMass, OtherLength, OtherTime > &other) const
 Get the dimension resulting from multiplying a quantity of this dimension with a quantity of another dimension.
template<int OtherMass, int OtherLength, int OtherTime>
consteval auto operator/ (const Dimension< OtherMass, OtherLength, OtherTime > &other) const
 Get the dimension resulting from dividing a quantity of this dimension by a quantity of another dimension.

Static Public Member Functions

static constexpr auto getSIUnitSymbolString ()
 Get an ASCII string representation of the symbol of the SI unit for this dimension, e.g. "kg m^2/s" if the dimension is ANGULAR_MOMENTUM.

Static Public Attributes

static constexpr int MASS = Mass
 Mass exponent of the dimension.
static constexpr int LENGTH = Length
 Length exponent of the dimension.
static constexpr int TIME = Time
 Time exponent of the dimension.

Friends

consteval auto sqrt (const Dimension &dimension)
 Get the dimension resulting from taking the square root of a quantity of a dimension.

Detailed Description

template<int Mass, int Length, int Time>
struct grem::physics::Dimension< Mass, Length, Time >

Physical dimension type template.

Part of the definition of a physical unit type.

Template Parameters
Massmass exponent.
Lengthlength exponent.
Timetime exponent.

Member Function Documentation

◆ getSIUnitSymbolString()

template<int Mass, int Length, int Time>
auto grem::physics::Dimension< Mass, Length, Time >::getSIUnitSymbolString ( )
staticnodiscardconstexpr

Get an ASCII string representation of the symbol of the SI unit for this dimension, e.g. "kg m^2/s" if the dimension is ANGULAR_MOMENTUM.

Returns
a String or StringView of the SI unit symbol string.

◆ operator==() [1/2]

template<int Mass, int Length, int Time>
bool grem::physics::Dimension< Mass, Length, Time >::operator== ( const Dimension< Mass, Length, Time > & other) const
inlinenodiscardconstevalnoexcept

Compare this dimension to another for equality.

Parameters
otherthe dimension to compare this one to.
Returns
true if the dimensions are equal, false otherwise.

◆ operator==() [2/2]

template<int Mass, int Length, int Time>
template<int OtherMass, int OtherLength, int OtherTime>
bool grem::physics::Dimension< Mass, Length, Time >::operator== ( const Dimension< OtherMass, OtherLength, OtherTime > & other) const
inlinenodiscardconstevalnoexcept

Compare this dimension to another for equality.

Parameters
otherthe dimension to compare this one to.
Returns
true if the dimensions are equal, false otherwise.

◆ operator+() [1/2]

template<int Mass, int Length, int Time>
auto grem::physics::Dimension< Mass, Length, Time >::operator+ ( ) const
inlinenodiscardconsteval

Get the dimension resulting from taking the additive identity of a quantity of this dimension.

Returns
the resulting dimension.

◆ operator-() [1/2]

template<int Mass, int Length, int Time>
auto grem::physics::Dimension< Mass, Length, Time >::operator- ( ) const
inlinenodiscardconsteval

Get the dimension resulting from taking the additive inverse of a quantity of this dimension.

Returns
the resulting dimension.

◆ operator+() [2/2]

template<int Mass, int Length, int Time>
auto grem::physics::Dimension< Mass, Length, Time >::operator+ ( const Dimension< Mass, Length, Time > & other) const
inlinenodiscardconsteval

Get the dimension resulting from adding a quantity of another dimension to a quantity of this dimension.

Parameters
otherthe dimension to add to this one.
Returns
the resulting dimension.

◆ operator-() [2/2]

template<int Mass, int Length, int Time>
auto grem::physics::Dimension< Mass, Length, Time >::operator- ( const Dimension< Mass, Length, Time > & other) const
inlinenodiscardconsteval

Get the dimension resulting from subtracting a quantity of another dimension from a quantity of this dimension.

Parameters
otherthe dimension to subtract from this one.
Returns
the resulting dimension.

◆ operator*()

template<int Mass, int Length, int Time>
template<int OtherMass, int OtherLength, int OtherTime>
auto grem::physics::Dimension< Mass, Length, Time >::operator* ( const Dimension< OtherMass, OtherLength, OtherTime > & other) const
inlinenodiscardconsteval

Get the dimension resulting from multiplying a quantity of this dimension with a quantity of another dimension.

Parameters
otherthe dimension to multiply this one with.
Returns
the resulting dimension.

◆ operator/()

template<int Mass, int Length, int Time>
template<int OtherMass, int OtherLength, int OtherTime>
auto grem::physics::Dimension< Mass, Length, Time >::operator/ ( const Dimension< OtherMass, OtherLength, OtherTime > & other) const
inlinenodiscardconsteval

Get the dimension resulting from dividing a quantity of this dimension by a quantity of another dimension.

Parameters
otherthe dimension to divide this one by.
Returns
the resulting dimension.

◆ sqrt

template<int Mass, int Length, int Time>
auto sqrt ( const Dimension< Mass, Length, Time > & dimension)
friend

Get the dimension resulting from taking the square root of a quantity of a dimension.

Parameters
dimensionthe dimension to take the square root of.
Returns
the resulting dimension.

Member Data Documentation

◆ MASS

template<int Mass, int Length, int Time>
int grem::physics::Dimension< Mass, Length, Time >::MASS = Mass
staticconstexpr

Mass exponent of the dimension.

◆ LENGTH

template<int Mass, int Length, int Time>
int grem::physics::Dimension< Mass, Length, Time >::LENGTH = Length
staticconstexpr

Length exponent of the dimension.

◆ TIME

template<int Mass, int Length, int Time>
int grem::physics::Dimension< Mass, Length, Time >::TIME = Time
staticconstexpr

Time exponent of the dimension.


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