GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::physics::Magnitude< Value, IsAbsolute > Struct Template Reference

Physical magnitude type template. More...

#include <GREM/physics/quantities.hpp>

Public Member Functions

consteval bool operator== (const Magnitude &other) const noexcept
 Compare this magnitude to another for equality.
template<long double OtherValue, bool OtherIsAbsolute>
consteval bool operator== (const Magnitude< OtherValue, OtherIsAbsolute > &other) const noexcept
 Compare this magnitude to another for equality.
consteval auto operator+ () const
 Get the magnitude resulting from taking the additive identity of a quantity of this magnitude.
consteval auto operator- () const
 Get the magnitude resulting from taking the additive inverse of a quantity of this magnitude.
template<long double OtherValue, bool OtherIsAbsolute>
consteval auto operator+ (const Magnitude< OtherValue, OtherIsAbsolute > &other) const
 Get the magnitude resulting from adding a quantity of another magnitude to a quantity of this magnitude.
template<long double OtherValue, bool OtherIsAbsolute>
consteval auto operator- (const Magnitude< OtherValue, OtherIsAbsolute > &other) const
 Get the magnitude resulting from subtracting a quantity of another magnitude from a quantity of this magnitude.
template<long double OtherValue, bool OtherIsAbsolute>
consteval auto operator* (const Magnitude< OtherValue, OtherIsAbsolute > &other) const
 Get the magnitude resulting from multiplying a quantity of this magnitude with a quantity of another magnitude.
template<long double OtherValue, bool OtherIsAbsolute>
consteval auto operator/ (const Magnitude< OtherValue, OtherIsAbsolute > &other) const
 Get the magnitude resulting from dividing a quantity of this magnitude by a quantity of another magnitude.

Static Public Attributes

static constexpr long double VALUE = Value
 Quantity multiplier of the magnitude.
static constexpr bool IS_ABSOLUTE = IsAbsolute
 Simplified indicator of the magnitude's reference frame (true for global world space, false for other).

Friends

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

Detailed Description

template<long double Value, bool IsAbsolute = false>
struct grem::physics::Magnitude< Value, IsAbsolute >

Physical magnitude type template.

Part of the definition of a physical unit type.

Template Parameters
Valuequantity multiplier.
IsAbsolutesimplified indicator of the magnitude's reference frame (true for global world space, false for other).

Member Function Documentation

◆ operator==() [1/2]

template<long double Value, bool IsAbsolute = false>
bool grem::physics::Magnitude< Value, IsAbsolute >::operator== ( const Magnitude< Value, IsAbsolute > & other) const
inlinenodiscardconstevalnoexcept

Compare this magnitude to another for equality.

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

◆ operator==() [2/2]

template<long double Value, bool IsAbsolute = false>
template<long double OtherValue, bool OtherIsAbsolute>
bool grem::physics::Magnitude< Value, IsAbsolute >::operator== ( const Magnitude< OtherValue, OtherIsAbsolute > & other) const
inlinenodiscardconstevalnoexcept

Compare this magnitude to another for equality.

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

◆ operator+() [1/2]

template<long double Value, bool IsAbsolute = false>
auto grem::physics::Magnitude< Value, IsAbsolute >::operator+ ( ) const
inlinenodiscardconsteval

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

Returns
the resulting magnitude.
Exceptions
physics::Errorif the additive identity cannot be taken.

◆ operator-() [1/2]

template<long double Value, bool IsAbsolute = false>
auto grem::physics::Magnitude< Value, IsAbsolute >::operator- ( ) const
inlinenodiscardconsteval

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

Returns
the resulting magnitude.
Exceptions
physics::Errorif the additive inverse cannot be taken.

◆ operator+() [2/2]

template<long double Value, bool IsAbsolute = false>
template<long double OtherValue, bool OtherIsAbsolute>
auto grem::physics::Magnitude< Value, IsAbsolute >::operator+ ( const Magnitude< OtherValue, OtherIsAbsolute > & other) const
inlinenodiscardconsteval

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

Parameters
otherthe magnitude to add to this one.
Returns
the resulting magnitude.
Exceptions
physics::Errorif quantities of the given magnitudes cannot be added.

◆ operator-() [2/2]

template<long double Value, bool IsAbsolute = false>
template<long double OtherValue, bool OtherIsAbsolute>
auto grem::physics::Magnitude< Value, IsAbsolute >::operator- ( const Magnitude< OtherValue, OtherIsAbsolute > & other) const
inlinenodiscardconsteval

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

Parameters
otherthe magnitude to subtract from this one.
Returns
the resulting magnitude.
Exceptions
physics::Errorif quantities of the given magnitudes cannot be subtracted.

◆ operator*()

template<long double Value, bool IsAbsolute = false>
template<long double OtherValue, bool OtherIsAbsolute>
auto grem::physics::Magnitude< Value, IsAbsolute >::operator* ( const Magnitude< OtherValue, OtherIsAbsolute > & other) const
inlinenodiscardconsteval

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

Parameters
otherthe magnitude to multiply this one with.
Returns
the resulting magnitude.
Exceptions
physics::Errorif quantities of the given magnitudes cannot be multiplied.

◆ operator/()

template<long double Value, bool IsAbsolute = false>
template<long double OtherValue, bool OtherIsAbsolute>
auto grem::physics::Magnitude< Value, IsAbsolute >::operator/ ( const Magnitude< OtherValue, OtherIsAbsolute > & other) const
inlinenodiscardconsteval

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

Parameters
otherthe magnitude to divide this one by.
Returns
the resulting magnitude.
Exceptions
physics::Errorif quantities of the given magnitudes cannot be divided.

◆ sqrt

template<long double Value, bool IsAbsolute = false>
auto sqrt ( const Magnitude< Value, IsAbsolute > & magnitude)
friend

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

Parameters
magnitudethe magnitude to take the square root of.
Returns
the resulting magnitude.

Member Data Documentation

◆ VALUE

template<long double Value, bool IsAbsolute = false>
long double grem::physics::Magnitude< Value, IsAbsolute >::VALUE = Value
staticconstexpr

Quantity multiplier of the magnitude.

◆ IS_ABSOLUTE

template<long double Value, bool IsAbsolute = false>
bool grem::physics::Magnitude< Value, IsAbsolute >::IS_ABSOLUTE = IsAbsolute
staticconstexpr

Simplified indicator of the magnitude's reference frame (true for global world space, false for other).


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