The Vector3 class represents the generic vector containing 3 elements. More...
#include <ignition/math/Vector3.hh>
Public Member Functions | |
Vector3 () | |
Constructor. More... | |
Vector3 (const T &_x, const T &_y, const T &_z) | |
Constructor. More... | |
Vector3 (const Vector3< T > &_v) | |
Copy constructor. More... | |
virtual | ~Vector3 () |
Destructor. More... | |
Vector3 | Abs () const |
Get the absolute value of the vector. More... | |
T | AbsDot (const Vector3< T > &_v) const |
Return the absolute dot product of this vector and another vector. More... | |
void | Correct () |
Corrects any nan values. More... | |
Vector3 | Cross (const Vector3< T > &_v) const |
Return the cross product of this vector with another vector. More... | |
T | Distance (const Vector3< T > &_pt) const |
Calc distance to the given point. More... | |
T | Distance (T _x, T _y, T _z) const |
Calc distance to the given point. More... | |
T | DistToLine (const Vector3< T > &_pt1, const Vector3 &_pt2) |
Get distance to a line. More... | |
T | Dot (const Vector3< T > &_v) const |
Return the dot product of this vector and another vector. More... | |
bool | Equal (const Vector3< T > &_v) const |
Equality test. 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 \ return the length. More... | |
void | Max (const Vector3< T > &_v) |
Set this vector's components to the maximum of itself and the passed in vector. More... | |
T | Max () const |
Get the maximum value in the vector. More... | |
void | Min (const Vector3< T > &_v) |
Set this vector's components to the minimum of itself and the passed in vector. More... | |
T | Min () const |
Get the minimum value in the vector. More... | |
Vector3 | Normalize () |
Normalize the vector length. More... | |
bool | operator!= (const Vector3< T > &_v) const |
Not equal to operator. More... | |
Vector3< T > | operator* (const Vector3< T > &_p) const |
Multiplication operator. More... | |
Vector3< T > | operator* (T _s) const |
Multiplication operators. More... | |
const Vector3< T > & | operator*= (const Vector3< T > &_v) |
Multiplication assignment operators. More... | |
const Vector3< T > & | operator*= (T _v) |
Multiplication operator. More... | |
Vector3 | operator+ (const Vector3< T > &_v) const |
Addition operator. More... | |
const Vector3 & | operator+= (const Vector3< T > &_v) |
Addition assignment operator. More... | |
Vector3 | operator- () const |
Negation operator. More... | |
Vector3< T > | operator- (const Vector3< T > &_pt) const |
Subtraction operators. More... | |
const Vector3< T > & | operator-= (const Vector3< T > &_pt) |
Subtraction assignment operators. More... | |
const Vector3< T > | operator/ (const Vector3< T > &_pt) const |
Division operator. More... | |
const Vector3< T > | operator/ (T _v) const |
Division operator. More... | |
const Vector3< T > & | operator/= (const Vector3< T > &_pt) |
Division assignment operator. More... | |
const Vector3< T > & | operator/= (T _v) |
Division assignment operator. More... | |
Vector3 & | operator= (const Vector3< T > &_v) |
Assignment operator. More... | |
Vector3 & | operator= (T _v) |
Assignment operator. More... | |
bool | operator== (const Vector3< T > &_v) const |
Equal to operator. More... | |
T | operator[] (size_t _index) const |
Array subscript operator. More... | |
Vector3 | Perpendicular () const |
Return a vector that is perpendicular to this one. More... | |
Vector3 | Round () |
Round to near whole number, return the result. More... | |
void | Round (int _precision) |
Round all values to _precision decimal places. More... | |
Vector3 | Rounded () const |
Get a rounded version of this vector. More... | |
void | Set (T _x=0, T _y=0, T _z=0) |
Set the contents of the vector. More... | |
T | SquaredLength () const |
Return the square of the length (magnitude) of the vector. More... | |
T | Sum () const |
Return the sum of the values. More... | |
T | X () const |
Get the x value. More... | |
T & | X () |
Get a mutable reference to the x value. More... | |
void | X (const T &_v) |
Set the x value. More... | |
T | Y () const |
Get the y value. More... | |
T & | Y () |
Get a mutable reference to the y value. More... | |
void | Y (const T &_v) |
Set the y value. More... | |
T | Z () const |
Get the z value. More... | |
T & | Z () |
Get a mutable reference to the z value. More... | |
void | Z (const T &_v) |
Set the z value. More... | |
Static Public Member Functions | |
static Vector3 | Normal (const Vector3< T > &_v1, const Vector3< T > &_v2, const Vector3< T > &_v3) |
Get a normal vector to a triangle. More... | |
Static Public Attributes | |
static const Vector3 | One |
math::Vector3(1, 1, 1) More... | |
static const Vector3 | UnitX |
math::Vector3(1, 0, 0) More... | |
static const Vector3 | UnitY |
math::Vector3(0, 1, 0) More... | |
static const Vector3 | UnitZ |
math::Vector3(0, 0, 1) More... | |
static const Vector3 | Zero |
math::Vector3(0, 0, 0) More... | |
Friends | |
Vector3< T > | operator* (T _s, const Vector3< T > &_v) |
Multiplication operators. More... | |
std::ostream & | operator<< (std::ostream &_out, const ignition::math::Vector3< T > &_pt) |
Stream insertion operator. More... | |
std::istream & | operator>> (std::istream &_in, ignition::math::Vector3< T > &_pt) |
Stream extraction operator. More... | |
The Vector3 class represents the generic vector containing 3 elements.
Since it's commonly used to keep coordinate system related information, its elements are labeled by x, y, z.
|
inline |
Constructor.
Referenced by ignition::math::Vector3< double >::Abs(), ignition::math::Vector3< double >::Cross(), ignition::math::Vector3< double >::Distance(), ignition::math::Vector3< double >::operator*(), ignition::math::Vector3< double >::operator+(), ignition::math::Vector3< double >::operator-(), ignition::math::Vector3< double >::operator/(), and ignition::math::Vector3< double >::Perpendicular().
|
inline |
Constructor.
[in] | _x | value along x |
[in] | _y | value along y |
[in] | _z | value along z |
|
inline |
Copy constructor.
[in] | _v | a vector |
|
inlinevirtual |
Destructor.
|
inline |
Get the absolute value of the vector.
|
inline |
Return the absolute dot product of this vector and another vector.
This is similar to the Dot function, except the absolute value of each component of the vector is used.
result = abs(x1 * x2) + abs(y1 * y2) + abs(z1 *z2)
[in] | _v | the vector |
|
inline |
Corrects any nan values.
|
inline |
Return the cross product of this vector with another vector.
[in] | _v | a vector |
Referenced by ignition::math::Vector3< double >::DistToLine(), ignition::math::Vector3< double >::Normal(), ignition::math::Quaternion< double >::operator*(), and ignition::math::Vector3< double >::Perpendicular().
|
inline |
Calc distance to the given point.
[in] | _pt | the point |
Referenced by ignition::math::Vector3< double >::Distance().
|
inline |
Calc distance to the given point.
[in] | _x | value along x |
[in] | _y | value along y |
[in] | _z | value along z |
|
inline |
Get distance to a line.
[in] | _pt1 | first point on the line |
[in] | _pt2 | second point on the line |
|
inline |
Return the dot product of this vector and another vector.
[in] | _v | the vector |
Referenced by ignition::math::Plane< T >::Distance().
|
inline |
Equality test.
[in] | _v | the other vector |
|
inline |
See if a point is finite (e.g., not nan)
|
inline |
Returns the length (magnitude) of the vector \ return the length.
Referenced by ignition::math::Vector3< double >::DistToLine().
|
inline |
Set this vector's components to the maximum of itself and the passed in vector.
[in] | _v | the maximum clamping vector |
|
inline |
Get the maximum value in the vector.
|
inline |
Set this vector's components to the minimum of itself and the passed in vector.
[in] | _v | the minimum clamping vector |
|
inline |
Get the minimum value in the vector.
|
inlinestatic |
Get a normal vector to a triangle.
[in] | _v1 | first vertex of the triangle |
[in] | _v2 | second vertex |
[in] | _v3 | third vertex |
|
inline |
Normalize the vector length.
Referenced by ignition::math::Vector3< double >::Normal().
|
inline |
Not equal to operator.
[in] | _v | The vector to compare against |
|
inline |
Multiplication operator.
[in] | _p | multiplier operator |
|
inline |
Multiplication operators.
[in] | _s | the scaling factor |
|
inline |
Multiplication assignment operators.
[in] | _v | a vector |
|
inline |
Multiplication operator.
[in] | _v | scaling factor |
|
inline |
Addition operator.
[in] | _v | vector to add |
|
inline |
Addition assignment operator.
[in] | _v | vector to add |
|
inline |
Negation operator.
|
inline |
Subtraction operators.
[in] | _pt | a vector to substract |
|
inline |
Subtraction assignment operators.
[in] | _pt | subtrahend |
|
inline |
Division operator.
[in] | _pt | the vector divisor |
|
inline |
Division operator.
[in] | _v | the divisor |
|
inline |
Division assignment operator.
[in] | _pt | the vector divisor |
|
inline |
Division assignment operator.
[in] | _v | the divisor |
|
inline |
Assignment operator.
[in] | _v | a new value |
|
inline |
Assignment operator.
[in] | _value | assigned to all elements |
|
inline |
Equal to operator.
[in] | _v | The vector to compare against |
|
inline |
Array subscript operator.
[in] | _index | The index, where 0 == x, 1 == y, 2 == z. |
IndexException | if _index is >= 3. |
|
inline |
Return a vector that is perpendicular to this one.
|
inline |
Round to near whole number, return the result.
Referenced by ignition::math::Vector3< double >::Rounded().
|
inline |
Round all values to _precision decimal places.
[in] | _precision | the decimal places |
|
inline |
Get a rounded version of this vector.
|
inline |
Set the contents of the vector.
[in] | _x | value along x |
[in] | _y | value along y |
[in] | _z | value aling z |
Referenced by ignition::math::Quaternion< double >::ToAxis().
|
inline |
Return the square of the length (magnitude) of the vector.
Referenced by ignition::math::Quaternion< double >::Integrate(), and ignition::math::Vector3< double >::Perpendicular().
|
inline |
Return the sum of the values.
|
inline |
Get the x value.
Referenced by ignition::math::Matrix3< T >::Axis(), ignition::math::Matrix4< double >::Axis(), ignition::math::Quaternion< double >::Axis(), ignition::math::Matrix3< T >::Col(), ignition::math::Pose3< double >::CoordPositionAdd(), ignition::math::Quaternion< double >::Euler(), ignition::math::Matrix4< double >::EulerRotation(), ignition::math::Quaternion< double >::Integrate(), ignition::math::Matrix3< T >::operator*(), ignition::math::Matrix4< double >::operator*(), ignition::math::Quaternion< double >::RotateVector(), ignition::math::Quaternion< double >::RotateVectorReverse(), ignition::math::Matrix4< double >::Scale(), ignition::math::Quaternion< double >::Scale(), ignition::math::Matrix4< double >::TransformAffine(), and ignition::math::Matrix4< double >::Translate().
|
inline |
Get a mutable reference to the x value.
|
inline |
Set the x value.
[in] | _v | Value for the x component. |
|
inline |
Get the y value.
Referenced by ignition::math::Matrix3< T >::Axis(), ignition::math::Matrix4< double >::Axis(), ignition::math::Quaternion< double >::Axis(), ignition::math::Matrix3< T >::Col(), ignition::math::Pose3< double >::CoordPositionAdd(), ignition::math::Quaternion< double >::Euler(), ignition::math::Matrix4< double >::EulerRotation(), ignition::math::Quaternion< double >::Integrate(), ignition::math::Matrix3< T >::operator*(), ignition::math::Matrix4< double >::operator*(), ignition::math::Quaternion< double >::RotateVector(), ignition::math::Quaternion< double >::RotateVectorReverse(), ignition::math::Matrix4< double >::Scale(), ignition::math::Quaternion< double >::Scale(), ignition::math::Matrix4< double >::TransformAffine(), and ignition::math::Matrix4< double >::Translate().
|
inline |
Get a mutable reference to the y value.
|
inline |
Set the y value.
[in] | _v | Value for the y component. |
|
inline |
Get the z value.
Referenced by ignition::math::Matrix3< T >::Axis(), ignition::math::Matrix4< double >::Axis(), ignition::math::Quaternion< double >::Axis(), ignition::math::Matrix3< T >::Col(), ignition::math::Pose3< double >::CoordPositionAdd(), ignition::math::Quaternion< double >::Euler(), ignition::math::Matrix4< double >::EulerRotation(), ignition::math::Quaternion< double >::Integrate(), ignition::math::Matrix3< T >::operator*(), ignition::math::Matrix4< double >::operator*(), ignition::math::Quaternion< double >::RotateVector(), ignition::math::Quaternion< double >::RotateVectorReverse(), ignition::math::Matrix4< double >::Scale(), ignition::math::Quaternion< double >::Scale(), ignition::math::Matrix4< double >::TransformAffine(), and ignition::math::Matrix4< double >::Translate().
|
inline |
Get a mutable reference to the z value.
|
inline |
Set the z value.
[in] | _v | Value for the z component. |
Multiplication operators.
[in] | _s | the scaling factor |
[in] | _v | input vector |
|
friend |
|
friend |
Stream extraction operator.
_in | input stream |
_pt | vector3 to read values into |
|
static |
math::Vector3(1, 1, 1)
|
static |
math::Vector3(1, 0, 0)
|
static |
math::Vector3(0, 1, 0)
|
static |
math::Vector3(0, 0, 1)
|
static |
math::Vector3(0, 0, 0)