Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
PhQ::PlanarPosition< NumericType > Class Template Reference

Two-dimensional Euclidean position vector in the XY plane. Contains two components in Cartesian coordinates: x and y. Position is not to be confused with displacement; for a two-dimensional Euclidean displacement vector in the XY plane, see PhQ::PlanarDisplacement. For a three-dimensional Euclidean position vector, see PhQ::Position. For scalar position components or for the magnitude of a position vector, see PhQ::Length. More...

#include "PlanarPosition.hpp"

Public Member Functions

 PlanarPosition ()=default
 Default constructor. Constructs a planar position vector with an uninitialized value. More...
 
 PlanarPosition (const PlanarVector< NumericType > &value, const Unit::Length unit)
 Constructor. Constructs a planar position vector with a given value expressed in a given length unit. More...
 
 PlanarPosition (const Length< NumericType > &x, const Length< NumericType > &y)
 Constructor. Constructs a planar position vector from a given set of length components. More...
 
constexpr PlanarPosition (const Length< NumericType > &length, const PlanarDirection< NumericType > &planar_direction)
 Constructor. Constructs a planar position vector from a given length and planar direction. More...
 
constexpr PlanarPosition (const Position< NumericType > &position)
 Constructor. Constructs a planar position vector from a given position vector by projecting the position vector onto the XY plane. More...
 
constexpr PlanarPosition (const PlanarDisplacement< NumericType > &planar_displacement)
 Constructor. Constructs a planar position vector from a given planar displacement vector from the origin. More...
 
 ~PlanarPosition () noexcept=default
 Destructor. Destroys this planar position vector. More...
 
constexpr PlanarPosition (const PlanarPosition< NumericType > &other)=default
 Copy constructor. Constructs a planar position vector by copying another one. More...
 
template<typename OtherNumericType >
constexpr PlanarPosition (const PlanarPosition< OtherNumericType > &other)
 Copy constructor. Constructs a planar position by copying another one. More...
 
constexpr PlanarPosition (PlanarPosition< NumericType > &&other) noexcept=default
 Move constructor. Constructs a planar position vector by moving another one. More...
 
constexpr PlanarPosition< NumericType > & operator= (const PlanarPosition< NumericType > &other)=default
 Copy assignment operator. Assigns this planar position vector by copying another one. More...
 
template<typename OtherNumericType >
constexpr PlanarPosition< NumericType > & operator= (const PlanarPosition< OtherNumericType > &other)
 Copy assignment operator. Assigns this planar position by copying another one. More...
 
constexpr PlanarPosition< NumericType > & operator= (PlanarPosition< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this planar position vector by moving another one. More...
 
constexpr Length< NumericType > x () const noexcept
 Returns the x Cartesian component of this planar position vector. More...
 
constexpr Length< NumericType > y () const noexcept
 Returns the y Cartesian component of this planar position vector. More...
 
Length< NumericType > Magnitude () const
 Returns the magnitude of this planar position vector. More...
 
PhQ::PlanarDirection< NumericType > PlanarDirection () const
 Returns the planar direction of this planar position vector. More...
 
PhQ::Angle< NumericType > Angle (const PlanarPosition< NumericType > &planar_position) const
 Returns the angle between this planar position vector and another one. More...
 
constexpr PlanarPosition< NumericType > operator+ (const PlanarPosition< NumericType > &planar_position) const
 
constexpr PlanarPosition< NumericType > operator+ (const PlanarDisplacement< NumericType > &planar_displacement) const
 
constexpr PlanarDisplacement< NumericType > operator- (const PlanarPosition< NumericType > &planar_position) const
 
constexpr PlanarPosition< NumericType > operator- (const PlanarDisplacement< NumericType > &planar_displacement) const
 
constexpr PlanarPosition< NumericType > operator* (const NumericType number) const
 
constexpr PlanarPosition< NumericType > operator/ (const NumericType number) const
 
constexpr void operator+= (const PlanarPosition< NumericType > &planar_position) noexcept
 
constexpr void operator+= (const PlanarDisplacement< NumericType > &planar_displacement) noexcept
 
constexpr void operator-= (const PlanarPosition< NumericType > &planar_position) noexcept
 
constexpr void operator-= (const PlanarDisplacement< NumericType > &planar_displacement) noexcept
 
constexpr void operator*= (const NumericType number) noexcept
 
constexpr void operator/= (const NumericType number) noexcept
 
constexpr const PhQ::PlanarVector< double > & Value () const noexcept
 Value of this physical quantity expressed in its standard unit of measure. More...
 
PhQ::PlanarVector< double > Value (const Unit::Length unit) const
 Value of this physical quantity expressed in a given unit of measure. More...
 
constexpr PhQ::PlanarVector< double > StaticValue () const
 Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time. More...
 
constexpr PhQ::PlanarVector< double > & MutableValue () noexcept
 Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value. More...
 
constexpr void SetValue (const PhQ::PlanarVector< double > &value) noexcept
 Sets the value of this physical quantity expressed in its standard unit of measure to the given value. More...
 
std::string Print () const
 Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string Print (const Unit::Length unit) const
 Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string JSON () const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string JSON (const Unit::Length unit) const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string XML () const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string XML (const Unit::Length unit) const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string YAML () const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string YAML (const Unit::Length unit) const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure. More...
 

Static Public Member Functions

static constexpr PlanarPosition< NumericType > Zero ()
 Statically creates a planar position vector of zero. More...
 
template<Unit::Length Unit>
static constexpr PlanarPosition< NumericType > Create (const NumericType x, const NumericType y)
 Statically creates a planar position vector from the given x and y Cartesian components expressed in a given length unit. More...
 
template<Unit::Length Unit>
static constexpr PlanarPosition< NumericType > Create (const std::array< NumericType, 2 > &x_y)
 Statically creates a planar position vector from the given x and y Cartesian components expressed in a given length unit. More...
 
template<Unit::Length Unit>
static constexpr PlanarPosition< NumericType > Create (const PlanarVector< NumericType > &value)
 Statically creates a planar position vector with a given value expressed in a given length unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Length Unit ()
 Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure. More...
 

Protected Attributes

PhQ::PlanarVector< double > value
 Value of this physical quantity expressed in its standard unit of measure. More...
 

Private Member Functions

constexpr PlanarPosition (const PlanarVector< NumericType > &value)
 Constructor. Constructs a planar position vector with a given value expressed in the standard length unit. More...
 

Friends

template<typename OtherNumericType >
class PlanarDisplacement
 

Detailed Description

template<typename NumericType = double>
class PhQ::PlanarPosition< NumericType >

Two-dimensional Euclidean position vector in the XY plane. Contains two components in Cartesian coordinates: x and y. Position is not to be confused with displacement; for a two-dimensional Euclidean displacement vector in the XY plane, see PhQ::PlanarDisplacement. For a three-dimensional Euclidean position vector, see PhQ::Position. For scalar position components or for the magnitude of a position vector, see PhQ::Length.

Definition at line 49 of file PlanarPosition.hpp.

Constructor & Destructor Documentation

◆ PlanarPosition() [1/10]

template<typename NumericType = double>
PhQ::PlanarPosition< NumericType >::PlanarPosition ( )
default

Default constructor. Constructs a planar position vector with an uninitialized value.

◆ PlanarPosition() [2/10]

template<typename NumericType = double>
PhQ::PlanarPosition< NumericType >::PlanarPosition ( const PlanarVector< NumericType > &  value,
const Unit::Length  unit 
)
inline

Constructor. Constructs a planar position vector with a given value expressed in a given length unit.

Definition at line 56 of file PlanarPosition.hpp.

◆ PlanarPosition() [3/10]

template<typename NumericType = double>
PhQ::PlanarPosition< NumericType >::PlanarPosition ( const Length< NumericType > &  x,
const Length< NumericType > &  y 
)
inline

Constructor. Constructs a planar position vector from a given set of length components.

Definition at line 60 of file PlanarPosition.hpp.

References PhQ::PlanarPosition< NumericType >::x(), and PhQ::PlanarPosition< NumericType >::y().

◆ PlanarPosition() [4/10]

template<typename NumericType = double>
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( const Length< NumericType > &  length,
const PlanarDirection< NumericType > &  planar_direction 
)
inlineconstexpr

Constructor. Constructs a planar position vector from a given length and planar direction.

Definition at line 65 of file PlanarPosition.hpp.

◆ PlanarPosition() [5/10]

template<typename NumericType >
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( const Position< NumericType > &  position)
inlineexplicitconstexpr

Constructor. Constructs a planar position vector from a given position vector by projecting the position vector onto the XY plane.

Definition at line 310 of file Position.hpp.

References PhQ::DimensionalVector< UnitType, NumericType >::Value().

◆ PlanarPosition() [6/10]

template<typename NumericType = double>
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( const PlanarDisplacement< NumericType > &  planar_displacement)
inlineexplicitconstexpr

Constructor. Constructs a planar position vector from a given planar displacement vector from the origin.

Definition at line 75 of file PlanarPosition.hpp.

◆ ~PlanarPosition()

template<typename NumericType = double>
PhQ::PlanarPosition< NumericType >::~PlanarPosition ( )
defaultnoexcept

Destructor. Destroys this planar position vector.

◆ PlanarPosition() [7/10]

template<typename NumericType = double>
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( const PlanarPosition< NumericType > &  other)
constexprdefault

Copy constructor. Constructs a planar position vector by copying another one.

◆ PlanarPosition() [8/10]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( const PlanarPosition< OtherNumericType > &  other)
inlineexplicitconstexpr

Copy constructor. Constructs a planar position by copying another one.

Definition at line 86 of file PlanarPosition.hpp.

◆ PlanarPosition() [9/10]

template<typename NumericType = double>
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( PlanarPosition< NumericType > &&  other)
constexprdefaultnoexcept

Move constructor. Constructs a planar position vector by moving another one.

◆ PlanarPosition() [10/10]

template<typename NumericType = double>
constexpr PhQ::PlanarPosition< NumericType >::PlanarPosition ( const PlanarVector< NumericType > &  value)
inlineexplicitconstexprprivate

Constructor. Constructs a planar position vector with a given value expressed in the standard length unit.

Definition at line 222 of file PlanarPosition.hpp.

Member Function Documentation

◆ Angle()

template<typename NumericType = double>
PhQ::Angle<NumericType> PhQ::PlanarPosition< NumericType >::Angle ( const PlanarPosition< NumericType > &  planar_position) const
inline

Returns the angle between this planar position vector and another one.

Definition at line 162 of file PlanarPosition.hpp.

◆ Create() [1/3]

template<typename NumericType = double>
template<Unit::Length Unit>
static constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::Create ( const NumericType  x,
const NumericType  y 
)
inlinestaticconstexpr

Statically creates a planar position vector from the given x and y Cartesian components expressed in a given length unit.

Definition at line 115 of file PlanarPosition.hpp.

References PhQ::PlanarPosition< NumericType >::x(), and PhQ::PlanarPosition< NumericType >::y().

◆ Create() [2/3]

template<typename NumericType = double>
template<Unit::Length Unit>
static constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::Create ( const PlanarVector< NumericType > &  value)
inlinestaticconstexpr

Statically creates a planar position vector with a given value expressed in a given length unit.

Definition at line 135 of file PlanarPosition.hpp.

References PhQ::DimensionalPlanarVector< Unit::Length, double >::value.

◆ Create() [3/3]

template<typename NumericType = double>
template<Unit::Length Unit>
static constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::Create ( const std::array< NumericType, 2 > &  x_y)
inlinestaticconstexpr

Statically creates a planar position vector from the given x and y Cartesian components expressed in a given length unit.

Definition at line 125 of file PlanarPosition.hpp.

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalPlanarVector< Unit::Length , double >::Dimensions ( )
inlinestaticconstexprinherited

Physical dimension set of this physical quantity.

Definition at line 50 of file DimensionalPlanarVector.hpp.

◆ JSON() [1/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::JSON ( ) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 103 of file DimensionalPlanarVector.hpp.

◆ JSON() [2/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::JSON ( const UnitType  unit) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 113 of file DimensionalPlanarVector.hpp.

◆ Magnitude()

template<typename NumericType = double>
Length<NumericType> PhQ::PlanarPosition< NumericType >::Magnitude ( ) const
inline

Returns the magnitude of this planar position vector.

Definition at line 152 of file PlanarPosition.hpp.

References PhQ::PlanarVector< NumericType >::Magnitude(), and PhQ::DimensionalPlanarVector< Unit::Length, double >::value.

◆ MutableValue()

constexpr PhQ::PlanarVector<double >& PhQ::DimensionalPlanarVector< Unit::Length , double >::MutableValue ( )
inlineconstexprnoexceptinherited

Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value.

Definition at line 79 of file DimensionalPlanarVector.hpp.

◆ operator*()

template<typename NumericType = double>
constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::operator* ( const NumericType  number) const
inlineconstexpr

◆ operator*=()

template<typename NumericType = double>
constexpr void PhQ::PlanarPosition< NumericType >::operator*= ( const NumericType  number)
inlineconstexprnoexcept

◆ operator+() [1/2]

template<typename NumericType = double>
constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::operator+ ( const PlanarDisplacement< NumericType > &  planar_displacement) const
inlineconstexpr

◆ operator+() [2/2]

template<typename NumericType = double>
constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::operator+ ( const PlanarPosition< NumericType > &  planar_position) const
inlineconstexpr

◆ operator+=() [1/2]

template<typename NumericType = double>
constexpr void PhQ::PlanarPosition< NumericType >::operator+= ( const PlanarDisplacement< NumericType > &  planar_displacement)
inlineconstexprnoexcept

◆ operator+=() [2/2]

template<typename NumericType = double>
constexpr void PhQ::PlanarPosition< NumericType >::operator+= ( const PlanarPosition< NumericType > &  planar_position)
inlineconstexprnoexcept

◆ operator-() [1/2]

template<typename NumericType = double>
constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::operator- ( const PlanarDisplacement< NumericType > &  planar_displacement) const
inlineconstexpr

◆ operator-() [2/2]

template<typename NumericType = double>
constexpr PlanarDisplacement<NumericType> PhQ::PlanarPosition< NumericType >::operator- ( const PlanarPosition< NumericType > &  planar_position) const
inlineconstexpr

◆ operator-=() [1/2]

template<typename NumericType = double>
constexpr void PhQ::PlanarPosition< NumericType >::operator-= ( const PlanarDisplacement< NumericType > &  planar_displacement)
inlineconstexprnoexcept

◆ operator-=() [2/2]

template<typename NumericType = double>
constexpr void PhQ::PlanarPosition< NumericType >::operator-= ( const PlanarPosition< NumericType > &  planar_position)
inlineconstexprnoexcept

◆ operator/()

template<typename NumericType = double>
constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::operator/ ( const NumericType  number) const
inlineconstexpr

◆ operator/=()

template<typename NumericType = double>
constexpr void PhQ::PlanarPosition< NumericType >::operator/= ( const NumericType  number)
inlineconstexprnoexcept

◆ operator=() [1/3]

template<typename NumericType = double>
constexpr PlanarPosition<NumericType>& PhQ::PlanarPosition< NumericType >::operator= ( const PlanarPosition< NumericType > &  other)
constexprdefault

Copy assignment operator. Assigns this planar position vector by copying another one.

◆ operator=() [2/3]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr PlanarPosition<NumericType>& PhQ::PlanarPosition< NumericType >::operator= ( const PlanarPosition< OtherNumericType > &  other)
inlineconstexpr

Copy assignment operator. Assigns this planar position by copying another one.

Definition at line 98 of file PlanarPosition.hpp.

References PhQ::DimensionalPlanarVector< UnitType, NumericType >::Value(), and PhQ::DimensionalPlanarVector< Unit::Length, double >::value.

◆ operator=() [3/3]

template<typename NumericType = double>
constexpr PlanarPosition<NumericType>& PhQ::PlanarPosition< NumericType >::operator= ( PlanarPosition< NumericType > &&  other)
constexprdefaultnoexcept

Move assignment operator. Assigns this planar position vector by moving another one.

◆ PlanarDirection()

template<typename NumericType = double>
PhQ::PlanarDirection<NumericType> PhQ::PlanarPosition< NumericType >::PlanarDirection ( ) const
inline

Returns the planar direction of this planar position vector.

Definition at line 157 of file PlanarPosition.hpp.

References PhQ::PlanarVector< NumericType >::PlanarDirection(), and PhQ::DimensionalPlanarVector< Unit::Length, double >::value.

◆ Print() [1/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::Print ( ) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 91 of file DimensionalPlanarVector.hpp.

◆ Print() [2/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::Print ( const UnitType  unit) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure.

Definition at line 97 of file DimensionalPlanarVector.hpp.

◆ SetValue()

constexpr void PhQ::DimensionalPlanarVector< Unit::Length , double >::SetValue ( const PhQ::PlanarVector< NumericType > &  value)
inlineconstexprnoexceptinherited

Sets the value of this physical quantity expressed in its standard unit of measure to the given value.

Definition at line 85 of file DimensionalPlanarVector.hpp.

◆ StaticValue()

constexpr PhQ::PlanarVector<double > PhQ::DimensionalPlanarVector< Unit::Length , double >::StaticValue ( ) const
inlineconstexprinherited

Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time.

Definition at line 73 of file DimensionalPlanarVector.hpp.

◆ Unit()

static constexpr Unit::Length PhQ::DimensionalPlanarVector< Unit::Length , double >::Unit ( )
inlinestaticconstexprinherited

Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure.

Definition at line 56 of file DimensionalPlanarVector.hpp.

◆ Value() [1/2]

constexpr const PhQ::PlanarVector<double >& PhQ::DimensionalPlanarVector< Unit::Length , double >::Value ( ) const
inlineconstexprnoexceptinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 61 of file DimensionalPlanarVector.hpp.

◆ Value() [2/2]

PhQ::PlanarVector<double > PhQ::DimensionalPlanarVector< Unit::Length , double >::Value ( const UnitType  unit) const
inlineinherited

Value of this physical quantity expressed in a given unit of measure.

Definition at line 66 of file DimensionalPlanarVector.hpp.

◆ x()

template<typename NumericType = double>
constexpr Length<NumericType> PhQ::PlanarPosition< NumericType >::x ( ) const
inlineconstexprnoexcept

◆ XML() [1/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::XML ( ) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 123 of file DimensionalPlanarVector.hpp.

◆ XML() [2/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::XML ( const UnitType  unit) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 133 of file DimensionalPlanarVector.hpp.

◆ y()

template<typename NumericType = double>
constexpr Length<NumericType> PhQ::PlanarPosition< NumericType >::y ( ) const
inlineconstexprnoexcept

◆ YAML() [1/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::YAML ( ) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 143 of file DimensionalPlanarVector.hpp.

◆ YAML() [2/2]

std::string PhQ::DimensionalPlanarVector< Unit::Length , double >::YAML ( const UnitType  unit) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 153 of file DimensionalPlanarVector.hpp.

◆ Zero()

template<typename NumericType = double>
static constexpr PlanarPosition<NumericType> PhQ::PlanarPosition< NumericType >::Zero ( )
inlinestaticconstexpr

Statically creates a planar position vector of zero.

Definition at line 108 of file PlanarPosition.hpp.

References PhQ::PlanarVector< NumericType >::Zero().

Friends And Related Function Documentation

◆ PlanarDisplacement

template<typename NumericType = double>
template<typename OtherNumericType >
friend class PlanarDisplacement
friend

Definition at line 226 of file PlanarPosition.hpp.

Member Data Documentation

◆ value

PhQ::PlanarVector<double > PhQ::DimensionalPlanarVector< Unit::Length , double >::value
protectedinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 222 of file DimensionalPlanarVector.hpp.


The documentation for this class was generated from the following files: