FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
math::Vec3 Class Reference

A class representing a vector in rectangular coordinates. More...

#include "geometry_ops.h"

Public Member Functions

 Vec3 () noexcept=default
 
 Vec3 (const Vec3 &) noexcept=default
 
 Vec3 (Vec3 &&) noexcept=default
 
Vec3operator= (const Vec3 &) noexcept=default
 
Vec3operator= (Vec3 &&) noexcept=default
 
 ~Vec3 () noexcept=default
 
constexpr Vec3 (const RealType x_value, const RealType y_value, const RealType z_value) noexcept
 Parameterized constructor for Vec3.
 
 Vec3 (const SVec3 &svec) noexcept
 Constructs a rectangular vector from a spherical SVec3.
 
Vec3operator+= (const Vec3 &b) noexcept
 Addition assignment operator for Vec3.
 
Vec3operator-= (const Vec3 &b) noexcept
 Subtraction assignment operator for Vec3.
 
Vec3operator*= (const Vec3 &b) noexcept
 Multiplication assignment operator for Vec3.
 
Vec3operator*= (const Matrix3 &m) noexcept
 Matrix multiplication assignment for Vec3.
 
Vec3operator*= (RealType b) noexcept
 Scalar multiplication assignment for Vec3.
 
Vec3operator/= (RealType b) noexcept
 Scalar division assignment for Vec3.
 
Vec3 operator+ (const RealType value) const
 Addition operator for Vec3.
 
Vec3 operator- () const
 Unary negation operator for Vec3.
 
RealType length () const noexcept
 Calculates the length (magnitude) of the vector.
 

Public Attributes

RealType x {}
 The x component of the vector.
 
RealType y {}
 The y component of the vector.
 
RealType z {}
 The z component of the vector.
 

Detailed Description

A class representing a vector in rectangular coordinates.

Definition at line 107 of file geometry_ops.h.

Constructor & Destructor Documentation

◆ Vec3() [1/5]

math::Vec3::Vec3 ( )
defaultnoexcept

◆ Vec3() [2/5]

math::Vec3::Vec3 ( const Vec3 )
defaultnoexcept

◆ Vec3() [3/5]

math::Vec3::Vec3 ( Vec3 &&  )
defaultnoexcept

◆ ~Vec3()

math::Vec3::~Vec3 ( )
defaultnoexcept

◆ Vec3() [4/5]

constexpr math::Vec3::Vec3 ( const RealType  x_value,
const RealType  y_value,
const RealType  z_value 
)
constexprnoexcept

Parameterized constructor for Vec3.

Parameters
x_valueThe x component.
y_valueThe y component.
z_valueThe z component.

Definition at line 128 of file geometry_ops.h.

128 :
130 {
131 }
RealType x
The x component of the vector.
RealType z
The z component of the vector.
RealType y
The y component of the vector.
math::Vec3 max

◆ Vec3() [5/5]

math::Vec3::Vec3 ( const SVec3 svec)
explicitnoexcept

Constructs a rectangular vector from a spherical SVec3.

Parameters
svecA spherical vector (SVec3) to convert.

Definition at line 44 of file geometry_ops.cpp.

44 :
45 x(svec.length * std::cos(svec.azimuth) * std::cos(svec.elevation)),
46 y(svec.length * std::sin(svec.azimuth) * std::cos(svec.elevation)), z(svec.length * std::sin(svec.elevation))
47 {
48 }
RealType length() const noexcept
Calculates the length (magnitude) of the vector.

Member Function Documentation

◆ length()

RealType math::Vec3::length ( ) const
noexcept

Calculates the length (magnitude) of the vector.

Returns
The length of the vector.

Definition at line 204 of file geometry_ops.h.

204{ return std::sqrt(x * x + y * y + z * z); }

References x, y, and z.

Referenced by XmlDocument::loadString().

+ Here is the caller graph for this function:

◆ operator*=() [1/3]

Vec3 & math::Vec3::operator*= ( const Matrix3 m)
noexcept

Matrix multiplication assignment for Vec3.

Parameters
mThe matrix to multiply by.
Returns
A reference to the updated Vec3.

Definition at line 74 of file geometry_ops.cpp.

75 {
76 const RealType* mat = m.getData();
77 const Vec3 v(x, y, z);
78 x = mat[0] * v.x + mat[1] * v.y + mat[2] * v.z;
79 y = mat[3] * v.x + mat[4] * v.y + mat[5] * v.z;
80 z = mat[6] * v.x + mat[7] * v.y + mat[8] * v.z;
81 return *this;
82 }
Vec3() noexcept=default
double RealType
Type for real numbers.
Definition config.h:27

References max, x, y, and z.

◆ operator*=() [2/3]

Vec3 & math::Vec3::operator*= ( const Vec3 b)
noexcept

Multiplication assignment operator for Vec3.

Parameters
bThe vector to multiply by.
Returns
A reference to the updated Vec3.

Definition at line 66 of file geometry_ops.cpp.

67 {
68 x *= b.x;
69 y *= b.y;
70 z *= b.z;
71 return *this;
72 }
RealType b

References b, and x.

◆ operator*=() [3/3]

Vec3 & math::Vec3::operator*= ( RealType  b)
noexcept

Scalar multiplication assignment for Vec3.

Parameters
bThe scalar value.
Returns
A reference to the updated Vec3.

Definition at line 84 of file geometry_ops.cpp.

85 {
86 x *= b;
87 y *= b;
88 z *= b;
89 return *this;
90 }

References b.

◆ operator+()

Vec3 math::Vec3::operator+ ( const RealType  value) const

Addition operator for Vec3.

Parameters
valueThe scalar value to add.
Returns
The resulting vector.

Definition at line 194 of file geometry_ops.h.

194{ return {x + value, y + value, z + value}; }

References x, y, and z.

◆ operator+=()

Vec3 & math::Vec3::operator+= ( const Vec3 b)
noexcept

Addition assignment operator for Vec3.

Parameters
bThe vector to add.
Returns
A reference to the updated Vec3.

Definition at line 50 of file geometry_ops.cpp.

51 {
52 x += b.x;
53 y += b.y;
54 z += b.z;
55 return *this;
56 }

References b, and x.

◆ operator-()

Vec3 math::Vec3::operator- ( ) const

Unary negation operator for Vec3.

Returns
The negated vector.

Definition at line 197 of file geometry_ops.h.

197{ return {-x, -y, -z}; }

References x, y, and z.

◆ operator-=()

Vec3 & math::Vec3::operator-= ( const Vec3 b)
noexcept

Subtraction assignment operator for Vec3.

Parameters
bThe vector to subtract.
Returns
A reference to the updated Vec3.

Definition at line 58 of file geometry_ops.cpp.

59 {
60 x -= b.x;
61 y -= b.y;
62 z -= b.z;
63 return *this;
64 }

References b, and x.

◆ operator/=()

Vec3 & math::Vec3::operator/= ( RealType  b)
noexcept

Scalar division assignment for Vec3.

Parameters
bThe scalar value.
Returns
A reference to the updated Vec3.

Definition at line 92 of file geometry_ops.cpp.

93 {
94 x /= b;
95 y /= b;
96 z /= b;
97 return *this;
98 }

References b.

◆ operator=() [1/2]

Vec3 & math::Vec3::operator= ( const Vec3 )
defaultnoexcept

◆ operator=() [2/2]

Vec3 & math::Vec3::operator= ( Vec3 &&  )
defaultnoexcept

Member Data Documentation

◆ x

◆ y

RealType math::Vec3::y {}

◆ z

RealType math::Vec3::z {}

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