Simple Application Framework
1
|
Class representing vector object from linear algebra. More...
#include <Vector.h>
Public Member Functions | |
Vector () | |
Default constructor. | |
Vector (const T &v) | |
Constructor. | |
Vector (const T &v1, const T &v2) | |
Constructor useful for 2D vectors. | |
Vector (const T &v1, const T &v2, const T &v3) | |
Constructor useful for 3D vectors. | |
Vector (const T &v1, const T &v2, const T &v3, const T &v4) | |
Constructor useful for 4D vectors. | |
Vector (const MyType &v) | |
Copy constructor. | |
T | Angle (const MyType &v) const |
Angle between two vectors in Euclidean space. | |
T | Angle (const MyType &v, const Matrix< N, N, T > &m) const |
Angle between two vectors in specific metric tensor space. | |
template<Size CN, class CT > | |
Vector< CN, CT > | Convert (CT padVal=0) const |
Convert vector to another data type or another dimension. | |
T | DotProduct (const MyType &v) const |
Compute Euclidean dot product. | |
MyType & | Fill (const T &val) |
Assign val to all vector elements. | |
T | Gcd () const |
Greatest common divisor of vector elements. | |
template<Size M> | |
T | InnerProduct (const Matrix< N, M, T > &m, const MyType &v) const |
Compute inner product using given matrix. | |
T | Lcm () const |
Least common multiple of vector elements. | |
T | Length () const |
Euclidean length of the vector. | |
T | Length (const Matrix< N, N, T > &m) const |
Length of the vector in specific metric tensor space. | |
template<Size M> | |
Vector< M, T > | Mul (const Matrix< N, M, T > &m) const |
Vector by matrix multiplication operator. | |
MyType & | Normalize () |
Normalize the vector. | |
MyType | Normalized () const |
Get normalized version of the vector. | |
MyType | operator* (const MyType &v) const |
Pointwise vector multiplication. | |
MyType | operator* (const T &v) const |
Vector multiplication by scalar. | |
MyType & | operator*= (const MyType &v) |
Pointwise vector multiplication operator. | |
MyType & | operator*= (const T &v) |
Multiplication by scalar value. | |
MyType | operator+ (const MyType &v) const |
Vector addition operator. | |
MyType & | operator+= (const MyType &v) |
Vector addition operator. | |
MyType | operator- (const MyType &v) const |
Vector substraction operator. | |
MyType | operator- () const |
Unary minus operator. | |
MyType & | operator-= (const MyType &v) |
Vector substraction operator. | |
MyType | operator/ (const MyType &v) const |
Pointwise vector division. | |
MyType | operator/ (const T &v) const |
Vector division by scalar. | |
MyType & | operator/= (const MyType &v) |
Pointwise vector division operator. | |
MyType & | operator/= (const T &v) |
Vector division by scalar. | |
bool | operator< (const MyType &v) const |
Lexicographical comparison. | |
bool | operator<= (const MyType &v) const |
Lexicographical comparison. | |
MyType & | operator= (const MyType &v) |
Assignment operator. | |
bool | operator> (const MyType &v) const |
Lexicographical comparison. | |
bool | operator>= (const MyType &v) const |
Lexicographical comparison. | |
template<Size M> | |
Matrix< N, M, T > | OuterProduct (const Vector< M, T > &v) |
Outer vector product. | |
T | Product () const |
Get the product of vector elements. | |
Int8 | Sgn () const |
Vector sign. | |
T | Sum () const |
Get sum of vector elements. | |
Matrix< N, 1, T > | ToColumnMatrix () const |
Convert column vector to a matrix. | |
Matrix< 1, N, T > | ToRowMatrix () const |
Convert row vector to a matrix. | |
Protected Types | |
typedef Collection::StaticArray< N, T > | BaseType |
typedef Vector< N, T > | MyType |
Class representing vector object from linear algebra.
N | Dimensionality of the space. |
T | Data type. |
typedef Collection::StaticArray<N,T> Saf::Math::Algebra::Vector< N, T >::BaseType [protected] |
typedef Vector<N,T> Saf::Math::Algebra::Vector< N, T >::MyType [protected] |
Reimplemented from Saf::Collection::StaticArray< N, T >.
Saf::Math::Algebra::Vector< N, T >::Vector | ( | ) | [inline] |
Default constructor.
No initialization of the elements is done.
Saf::Math::Algebra::Vector< N, T >::Vector | ( | const T & | v | ) | [inline, explicit] |
Constructor.
Initializes all elements with given value.
Saf::Math::Algebra::Vector< N, T >::Vector | ( | const T & | v1, |
const T & | v2 | ||
) | [inline] |
Constructor useful for 2D vectors.
Saf::Math::Algebra::Vector< N, T >::Vector | ( | const T & | v1, |
const T & | v2, | ||
const T & | v3 | ||
) | [inline] |
Constructor useful for 3D vectors.
Saf::Math::Algebra::Vector< N, T >::Vector | ( | const T & | v1, |
const T & | v2, | ||
const T & | v3, | ||
const T & | v4 | ||
) | [inline] |
Constructor useful for 4D vectors.
Saf::Math::Algebra::Vector< N, T >::Vector | ( | const MyType & | v | ) | [inline] |
Copy constructor.
T Saf::Math::Algebra::Vector< N, T >::Angle | ( | const MyType & | v | ) | const [inline] |
Angle between two vectors in Euclidean space.
T Saf::Math::Algebra::Vector< N, T >::Angle | ( | const MyType & | v, |
const Matrix< N, N, T > & | m | ||
) | const [inline] |
Angle between two vectors in specific metric tensor space.
[in] | v | A vector. |
[in] | m | Metric tensor. Positive definite symmetric bilinear form. |
Vector<CN,CT> Saf::Math::Algebra::Vector< N, T >::Convert | ( | CT | padVal = 0 | ) | const [inline] |
Convert vector to another data type or another dimension.
If CN < N
, then the vector is truncated, otherwise it is padded with padVal
.
T Saf::Math::Algebra::Vector< N, T >::DotProduct | ( | const MyType & | v | ) | const [inline] |
Compute Euclidean dot product.
MyType& Saf::Math::Algebra::Vector< N, T >::Fill | ( | const T & | val | ) | [inline] |
Assign val
to all vector elements.
T Saf::Math::Algebra::Vector< N, T >::Gcd | ( | ) | const [inline] |
Greatest common divisor of vector elements.
T Saf::Math::Algebra::Vector< N, T >::InnerProduct | ( | const Matrix< N, M, T > & | m, |
const MyType & | v | ||
) | const [inline] |
Compute inner product using given matrix.
T Saf::Math::Algebra::Vector< N, T >::Lcm | ( | ) | const [inline] |
Least common multiple of vector elements.
T Saf::Math::Algebra::Vector< N, T >::Length | ( | ) | const [inline] |
Euclidean length of the vector.
T Saf::Math::Algebra::Vector< N, T >::Length | ( | const Matrix< N, N, T > & | m | ) | const [inline] |
Length of the vector in specific metric tensor space.
This method computes .
[in] | m | Metric tensor. Positive definite symmetric bilinear form. |
Vector<M,T> Saf::Math::Algebra::Vector< N, T >::Mul | ( | const Matrix< N, M, T > & | m | ) | const [inline] |
Vector by matrix multiplication operator.
MyType& Saf::Math::Algebra::Vector< N, T >::Normalize | ( | ) | [inline] |
Normalize the vector.
MyType Saf::Math::Algebra::Vector< N, T >::Normalized | ( | ) | const [inline] |
Get normalized version of the vector.
MyType Saf::Math::Algebra::Vector< N, T >::operator* | ( | const MyType & | v | ) | const [inline] |
Pointwise vector multiplication.
MyType Saf::Math::Algebra::Vector< N, T >::operator* | ( | const T & | v | ) | const [inline] |
Vector multiplication by scalar.
MyType& Saf::Math::Algebra::Vector< N, T >::operator*= | ( | const MyType & | v | ) | [inline] |
Pointwise vector multiplication operator.
MyType& Saf::Math::Algebra::Vector< N, T >::operator*= | ( | const T & | v | ) | [inline] |
Multiplication by scalar value.
MyType Saf::Math::Algebra::Vector< N, T >::operator+ | ( | const MyType & | v | ) | const [inline] |
Vector addition operator.
MyType& Saf::Math::Algebra::Vector< N, T >::operator+= | ( | const MyType & | v | ) | [inline] |
Vector addition operator.
MyType Saf::Math::Algebra::Vector< N, T >::operator- | ( | const MyType & | v | ) | const [inline] |
Vector substraction operator.
MyType Saf::Math::Algebra::Vector< N, T >::operator- | ( | ) | const [inline] |
Unary minus operator.
MyType& Saf::Math::Algebra::Vector< N, T >::operator-= | ( | const MyType & | v | ) | [inline] |
Vector substraction operator.
MyType Saf::Math::Algebra::Vector< N, T >::operator/ | ( | const MyType & | v | ) | const [inline] |
Pointwise vector division.
MyType Saf::Math::Algebra::Vector< N, T >::operator/ | ( | const T & | v | ) | const [inline] |
Vector division by scalar.
MyType& Saf::Math::Algebra::Vector< N, T >::operator/= | ( | const MyType & | v | ) | [inline] |
Pointwise vector division operator.
MyType& Saf::Math::Algebra::Vector< N, T >::operator/= | ( | const T & | v | ) | [inline] |
Vector division by scalar.
bool Saf::Math::Algebra::Vector< N, T >::operator< | ( | const MyType & | v | ) | const [inline] |
Lexicographical comparison.
bool Saf::Math::Algebra::Vector< N, T >::operator<= | ( | const MyType & | v | ) | const [inline] |
Lexicographical comparison.
MyType& Saf::Math::Algebra::Vector< N, T >::operator= | ( | const MyType & | v | ) | [inline] |
Assignment operator.
Reimplemented from Saf::Collection::StaticArray< N, T >.
bool Saf::Math::Algebra::Vector< N, T >::operator> | ( | const MyType & | v | ) | const [inline] |
Lexicographical comparison.
bool Saf::Math::Algebra::Vector< N, T >::operator>= | ( | const MyType & | v | ) | const [inline] |
Lexicographical comparison.
Matrix<N,M,T> Saf::Math::Algebra::Vector< N, T >::OuterProduct | ( | const Vector< M, T > & | v | ) | [inline] |
Outer vector product.
T Saf::Math::Algebra::Vector< N, T >::Product | ( | ) | const [inline] |
Get the product of vector elements.
Int8 Saf::Math::Algebra::Vector< N, T >::Sgn | ( | ) | const [inline] |
Vector sign.
T Saf::Math::Algebra::Vector< N, T >::Sum | ( | ) | const [inline] |
Get sum of vector elements.
Matrix<N,1,T> Saf::Math::Algebra::Vector< N, T >::ToColumnMatrix | ( | ) | const [inline] |
Convert column vector to a matrix.
Matrix<1,N,T> Saf::Math::Algebra::Vector< N, T >::ToRowMatrix | ( | ) | const [inline] |
Convert row vector to a matrix.