FERS 1.0.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
 
constexpr Vec3 (const RealType x, const RealType y, const RealType z) 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
 
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 105 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() [4/5]

constexpr math::Vec3::Vec3 ( const RealType  x,
const RealType  y,
const RealType  z 
)
constexprnoexcept

Parameterized constructor for Vec3.

Parameters
xThe x component.
yThe y component.
zThe z component.

Definition at line 125 of file geometry_ops.h.

125: x(x), y(y), z(z) {}
RealType x
The x component of the vector.
RealType z
The z component of the vector.
RealType y
The y component of the vector.

◆ 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 17 of file geometry_ops.cpp.

17 :
18 x(svec.length * std::cos(svec.azimuth) * std::cos(svec.elevation)),
19 y(svec.length * std::sin(svec.azimuth) * std::cos(svec.elevation)), z(svec.length * std::sin(svec.elevation))
20 {
21 }

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 197 of file geometry_ops.h.

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

References x, y, and z.

Referenced by simulation::calculatePreviewLinks().

+ 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 47 of file geometry_ops.cpp.

48 {
49 const RealType* mat = m.getData();
50 const Vec3 v(x, y, z);
51 x = mat[0] * v.x + mat[1] * v.y + mat[2] * v.z;
52 y = mat[3] * v.x + mat[4] * v.y + mat[5] * v.z;
53 z = mat[6] * v.x + mat[7] * v.y + mat[8] * v.z;
54 return *this;
55 }
Vec3() noexcept=default
double RealType
Type for real numbers.
Definition config.h:27

References 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 39 of file geometry_ops.cpp.

40 {
41 x *= b.x;
42 y *= b.y;
43 z *= b.z;
44 return *this;
45 }

References 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 57 of file geometry_ops.cpp.

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

◆ operator+()

Addition operator for Vec3.

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

Definition at line 188 of file geometry_ops.h.

188{ 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 23 of file geometry_ops.cpp.

24 {
25 x += b.x;
26 y += b.y;
27 z += b.z;
28 return *this;
29 }

References x.

◆ operator-()

Definition at line 190 of file geometry_ops.h.

190{ 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 31 of file geometry_ops.cpp.

32 {
33 x -= b.x;
34 y -= b.y;
35 z -= b.z;
36 return *this;
37 }

References 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 65 of file geometry_ops.cpp.

66 {
67 x /= b;
68 y /= b;
69 z /= b;
70 return *this;
71 }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Member Data Documentation

◆ x

RealType math::Vec3::x {}

The x component of the vector.

Definition at line 108 of file geometry_ops.h.

108{}; ///< The x component of the vector

Referenced by fers_get_interpolated_motion_path(), math::from_json(), serial::KmlGenerator::generateKml(), length(), operator*=(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), math::operator/(), and math::to_json().

◆ y

RealType math::Vec3::y {}

The y component of the vector.

Definition at line 109 of file geometry_ops.h.

109{}; ///< The y component of the vector

Referenced by fers_get_interpolated_motion_path(), math::from_json(), serial::KmlGenerator::generateKml(), length(), operator*=(), operator+(), operator-(), math::operator/(), and math::to_json().

◆ z

RealType math::Vec3::z {}

The z component of the vector.

Definition at line 110 of file geometry_ops.h.

110{}; ///< The z component of the vector

Referenced by fers_get_interpolated_motion_path(), math::from_json(), serial::KmlGenerator::generateKml(), length(), operator*=(), operator+(), operator-(), math::operator/(), and math::to_json().


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