vector.hpp#
-
template<size_t n>
class Vector# - #include <vector.hpp>
n-Vector class Fixed size array
Functions
-
template<size_t n>
Vector<n> operator+(const Vector<n> &a, const Vector<n> &b)# Vectorial sum
- Parameters
a – one vector
b – other vector
- Returns
vectorial sum a + b
-
template<size_t n>
Vector<n> operator-(const Vector<n> &a, const Vector<n> &b)# Vectorial difference
- Parameters
a – one vector
b – another vector
- Returns
vectorial sum a + (-b)
-
template<size_t n>
Vector<n> operator*(const Vector<n> &a, double t)# Scalar vector multiplication
- Parameters
a – a vector
t – a scalar
- Returns
scaled vector t * a
-
template<size_t n>
Vector<n> operator*(double t, const Vector<n> &a)# Scalar vector multiplication
- Parameters
t – a scalar
a – a vector
- Returns
scaled vector t * a
-
template<size_t n>
Vector<n> operator*(const Vector<n> &a, const Vector<n> &b)# Element-wise vector multiplication
- Parameters
a – a vector
b – other vector
- Returns
scaled vector t * a
-
template<size_t n>
Vector<n> operator/(const Vector<n> &a, double t)# Vector divided by scalar
- Parameters
a – a vector
t – a scalar
- Returns
scaled vector a / t
-
template<size_t n>
double dot(const Vector<n> &a, const Vector<n> &b)# Dot product between two vector
- Parameters
a – one vector
b – another vector
- Returns
dot product a . b
-
template<size_t n>
double mod(const Vector<n> &v)# Modulus of vector (2-norm)
- Parameters
v – a vector
- Returns
|v|
-
template<size_t n>
bool hasnan(const Vector<n> &v)# Checks if there is a nan value inside
- Parameters
v – Vector
- Returns
true if there is a nan value
-
template<size_t n>
std::ostream &operator<<(std::ostream &out, const Vector<n> &v)# Out stream operator
-
Vector3 cross(const Vector3 &a, const Vector3 &b)#
Cross product between two 3-Vectors
- Parameters
a – one vector
b – another vector
- Returns
dot product a x b
-
double angle_between(const Vector3 &a, const Vector3 &b)#
Angle between two 3-Vectors
- Parameters
a – one vector
b – another vector
- Returns
dot product a x b
-
double pitch_between(const Vector3 &a, const Vector3 &b)#
Pitch between two 3-Vectors
- Parameters
a – one vector
b – another vector
- Returns
dot product a x b
-
Vector3 get_position(const State &x)#
Get position form a state
- Parameters
x – state
- Returns
position
-
Vector3 get_velocity(const State &x)#
Get velocity form a state
- Parameters
x – state
- Returns
velocity
-
inline Vector3 cyl2cart(const Vector3 &v, double theta)#
Convert vector from cylindrical coordinates to cartesian
- Parameters
v – cylindrical vector
r – cylindrical position
- Returns
vector in cartesian
-
inline Vector3 cart2cyl(const Vector3 &v, double theta)#
Convert vector from cartesian coordinates to cylindrical
- Parameters
v – cartesian vector
r – cylindrical position
- Returns
vector in cylindrical