T Generic x, y, z, w vector. More...
#include <ignition/math/Vector4.hh>
Public Member Functions | |
Vector4 () | |
Constructor. More... | |
Vector4 (const T &_x, const T &_y, const T &_z, const T &_w) | |
Constructor with component values. More... | |
Vector4 (const Vector4< T > &_v) | |
Copy constructor. More... | |
virtual | ~Vector4 () |
Destructor. More... | |
T | Distance (const Vector4< T > &_pt) const |
Calc distance to the given point. More... | |
bool | Equal (const Vector4 &_v, const T &_tol) const |
Equality test with tolerance. More... | |
bool | IsFinite () const |
See if a point is finite (e.g., not nan) More... | |
T | Length () const |
Returns the length (magnitude) of the vector. More... | |
void | Normalize () |
Normalize the vector length. More... | |
bool | operator!= (const Vector4< T > &_pt) const |
Not equal to operator. More... | |
const Vector4< T > | operator* (const Vector4< T > &_pt) const |
Multiplication operator. More... | |
const Vector4< T > | operator* (const Matrix4< T > &_m) const |
Matrix multiplication operator. More... | |
const Vector4< T > | operator* (T _v) const |
Multiplication operators. More... | |
const Vector4< T > & | operator*= (const Vector4< T > &_pt) |
Multiplication assignment operator. More... | |
const Vector4< T > & | operator*= (T _v) |
Multiplication assignment operator. More... | |
Vector4< T > | operator+ (const Vector4< T > &_v) const |
Addition operator. More... | |
Vector4< T > | operator+ (const T _s) const |
Addition operators. More... | |
const Vector4< T > & | operator+= (const Vector4< T > &_v) |
Addition operator. More... | |
const Vector4< T > & | operator+= (const T _s) |
Addition assignment operator. More... | |
Vector4 | operator- () const |
Negation operator. More... | |
Vector4< T > | operator- (const Vector4< T > &_v) const |
Subtraction operator. More... | |
Vector4< T > | operator- (const T _s) const |
Subtraction operators. More... | |
const Vector4< T > & | operator-= (const Vector4< T > &_v) |
Subtraction assigment operators. More... | |
const Vector4< T > & | operator-= (const T _s) |
Subtraction assignment operator. More... | |
const Vector4< T > | operator/ (const Vector4< T > &_v) const |
Division assignment operator. More... | |
const Vector4< T > | operator/ (T _v) const |
Division assignment operator. More... | |
const Vector4< T > & | operator/= (const Vector4< T > &_v) |
Division assignment operator. More... | |
const Vector4< T > & | operator/= (T _v) |
Division operator. More... | |
Vector4< T > & | operator= (const Vector4< T > &_v) |
Assignment operator. More... | |
Vector4< T > & | operator= (T _value) |
Assignment operator. More... | |
bool | operator== (const Vector4< T > &_v) const |
Equal to operator. More... | |
T & | operator[] (const std::size_t _index) |
Array subscript operator. More... | |
T | operator[] (const std::size_t _index) const |
Const-qualified array subscript operator. More... | |
void | Set (T _x=0, T _y=0, T _z=0, T _w=0) |
Set the contents of the vector. More... | |
T | SquaredLength () const |
Return the square of the length (magnitude) of the vector. More... | |
T & | W () |
Return a mutable w value. More... | |
T | W () const |
Get the w value. More... | |
void | W (const T &_v) |
Set the w value. More... | |
T & | X () |
Return a mutable x value. More... | |
T | X () const |
Get the x value. More... | |
void | X (const T &_v) |
Set the x value. More... | |
T & | Y () |
Return a mutable y value. More... | |
T | Y () const |
Get the y value. More... | |
void | Y (const T &_v) |
Set the y value. More... | |
T & | Z () |
Return a mutable z value. More... | |
T | Z () const |
Get the z value. More... | |
void | Z (const T &_v) |
Set the z value. More... | |
Static Public Attributes | |
static const Vector4< T > | One |
math::Vector4(1, 1, 1, 1) More... | |
static const Vector4< T > | Zero |
math::Vector4(0, 0, 0, 0) More... | |
Friends | |
const Vector4 | operator* (const T _s, const Vector4 &_v) |
Scalar left multiplication operators. More... | |
Vector4< T > | operator+ (const T _s, const Vector4< T > &_v) |
Addition operators. More... | |
Vector4< T > | operator- (const T _s, const Vector4< T > &_v) |
Subtraction operators. More... | |
std::ostream & | operator<< (std::ostream &_out, const Vector4< T > &_pt) |
Stream insertion operator. More... | |
std::istream & | operator>> (std::istream &_in, Vector4< T > &_pt) |
Stream extraction operator. More... | |
Detailed Description
template<typename T>
class ignition::math::Vector4< T >
T Generic x, y, z, w vector.
Constructor & Destructor Documentation
◆ Vector4() [1/3]
|
inline |
Constructor.
Referenced by Vector4< T >::operator-().
◆ Vector4() [2/3]
|
inline |
Constructor with component values.
- Parameters
-
[in] _x value along x axis [in] _y value along y axis [in] _z value along z axis [in] _w value along w axis
◆ Vector4() [3/3]
◆ ~Vector4()
|
inlinevirtual |
Destructor.
Member Function Documentation
◆ Distance()
|
inline |
Calc distance to the given point.
- Parameters
-
[in] _pt the point
- Returns
- the distance
◆ Equal()
|
inline |
Equality test with tolerance.
- Parameters
-
[in] _v the vector to compare to [in] _tol equality tolerance.
- Returns
- true if the elements of the vectors are equal within the tolerence specified by _tol.
Referenced by Vector4< T >::operator==().
◆ IsFinite()
|
inline |
See if a point is finite (e.g., not nan)
- Returns
- true if finite, false otherwise
References std::isfinite().
◆ Length()
|
inline |
Returns the length (magnitude) of the vector.
- Returns
- The length
References Vector4< T >::SquaredLength().
Referenced by Vector4< T >::Normalize().
◆ Normalize()
|
inline |
Normalize the vector length.
References Vector4< T >::Length().
◆ operator!=()
|
inline |
Not equal to operator.
- Parameters
-
[in] _pt the other vector
- Returns
- false if each component is equal within a default tolerence (1e-6), true otherwise
◆ operator*() [1/3]
Multiplication operator.
- Remarks
- Performs element wise multiplication, which has limited use.
- Parameters
-
[in] _pt another vector
- Returns
- result vector
◆ operator*() [2/3]
Matrix multiplication operator.
- Parameters
-
[in] _m matrix
- Returns
- the vector multiplied by _m
◆ operator*() [3/3]
|
inline |
Multiplication operators.
- Parameters
-
[in] _v scaling factor
- Returns
- a scaled vector
◆ operator*=() [1/2]
Multiplication assignment operator.
- Remarks
- Performs element wise multiplication, which has limited use.
- Parameters
-
[in] _pt a vector
- Returns
- this
◆ operator*=() [2/2]
|
inline |
Multiplication assignment operator.
- Parameters
-
[in] _v scaling factor
- Returns
- this
◆ operator+() [1/2]
Addition operator.
- Parameters
-
[in] _v the vector to add
- Returns
- a sum vector
◆ operator+() [2/2]
|
inline |
Addition operators.
- Parameters
-
[in] _s the scalar addend
- Returns
- sum vector
◆ operator+=() [1/2]
Addition operator.
- Parameters
-
[in] _v the vector to add
- Returns
- this vector
◆ operator+=() [2/2]
|
inline |
Addition assignment operator.
- Parameters
-
[in] _s scalar addend
- Returns
- this
◆ operator-() [1/3]
|
inline |
◆ operator-() [2/3]
Subtraction operator.
- Parameters
-
[in] _v the vector to substract
- Returns
- a vector
◆ operator-() [3/3]
|
inline |
Subtraction operators.
- Parameters
-
[in] _s the scalar subtrahend
- Returns
- difference vector
◆ operator-=() [1/2]
Subtraction assigment operators.
- Parameters
-
[in] _v the vector to substract
- Returns
- this vector
◆ operator-=() [2/2]
|
inline |
Subtraction assignment operator.
- Parameters
-
[in] _s scalar subtrahend
- Returns
- this
◆ operator/() [1/2]
Division assignment operator.
- Remarks
- Performs element wise division, which has limited use.
- Parameters
-
[in] _v the vector to perform element wise division with
- Returns
- a result vector
◆ operator/() [2/2]
|
inline |
Division assignment operator.
- Remarks
- Performs element wise division, which has limited use.
- Parameters
-
[in] _v another vector
- Returns
- a result vector
◆ operator/=() [1/2]
Division assignment operator.
- Remarks
- Performs element wise division, which has limited use.
- Parameters
-
[in] _v the vector to perform element wise division with
- Returns
- this
◆ operator/=() [2/2]
|
inline |
Division operator.
- Parameters
-
[in] _v scaling factor
- Returns
- a vector
◆ operator=() [1/2]
Assignment operator.
- Parameters
-
[in] _v the vector
- Returns
- a reference to this vector
◆ operator=() [2/2]
|
inline |
Assignment operator.
- Parameters
-
[in] _value
◆ operator==()
|
inline |
Equal to operator.
- Parameters
-
[in] _v the other vector
- Returns
- true if each component is equal within a default tolerence (1e-6), false otherwise
References Vector4< T >::Equal().
◆ operator[]() [1/2]
|
inline |
Array subscript operator.
- Parameters
-
[in] _index The index, where 0 == x, 1 == y, 2 == z, 3 == w. The index is clamped to the range (0,3).
- Returns
- The value.
References ignition::math::clamp(), ignition::math::IGN_THREE_SIZE_T, and ignition::math::IGN_ZERO_SIZE_T.
◆ operator[]() [2/2]
|
inline |
Const-qualified array subscript operator.
- Parameters
-
[in] _index The index, where 0 == x, 1 == y, 2 == z, 3 == w. The index is clamped to the range (0,3).
- Returns
- The value.
References ignition::math::clamp(), ignition::math::IGN_THREE_SIZE_T, and ignition::math::IGN_ZERO_SIZE_T.
◆ Set()
|
inline |
Set the contents of the vector.
- Parameters
-
[in] _x value along x axis [in] _y value along y axis [in] _z value along z axis [in] _w value along w axis
◆ SquaredLength()
|
inline |
Return the square of the length (magnitude) of the vector.
- Returns
- the length
References std::pow().
Referenced by Vector4< T >::Length().
◆ W() [1/3]
|
inline |
Return a mutable w value.
- Returns
- The w component of the vector
◆ W() [2/3]
|
inline |
Get the w value.
- Returns
- The w component of the vector
◆ W() [3/3]
|
inline |
Set the w value.
- Parameters
-
[in] _v Value for the w component.
◆ X() [1/3]
|
inline |
Return a mutable x value.
- Returns
- The x component of the vector
◆ X() [2/3]
|
inline |
Get the x value.
- Returns
- The x component of the vector
◆ X() [3/3]
|
inline |
Set the x value.
- Parameters
-
[in] _v Value for the x component.
◆ Y() [1/3]
|
inline |
Return a mutable y value.
- Returns
- The y component of the vector
◆ Y() [2/3]
|
inline |
Get the y value.
- Returns
- The y component of the vector
◆ Y() [3/3]
|
inline |
Set the y value.
- Parameters
-
[in] _v Value for the y component.
◆ Z() [1/3]
|
inline |
Return a mutable z value.
- Returns
- The z component of the vector
◆ Z() [2/3]
|
inline |
Get the z value.
- Returns
- The z component of the vector
◆ Z() [3/3]
|
inline |
Set the z value.
- Parameters
-
[in] _v Value for the z component.
Friends And Related Function Documentation
◆ operator*
Scalar left multiplication operators.
- Parameters
-
[in] _s the scaling factor [in] _v the vector to scale
- Returns
- a scaled vector
◆ operator+
Addition operators.
- Parameters
-
[in] _s the scalar addend [in] _v input vector
- Returns
- sum vector
◆ operator-
Subtraction operators.
- Parameters
-
[in] _s the scalar minuend [in] _v vector subtrahend
- Returns
- difference vector
◆ operator<<
|
friend |
Stream insertion operator.
- Parameters
-
[in] _out output stream [in] _pt Vector4 to output
- Returns
- The stream
◆ operator>>
|
friend |
Stream extraction operator.
- Parameters
-
[in] _in input stream [in] _pt Vector4 to read values into
- Returns
- the stream
Member Data Documentation
◆ One
|
static |
math::Vector4(1, 1, 1, 1)
◆ Zero
|
static |
math::Vector4(0, 0, 0, 0)
The documentation for this class was generated from the following file: