Two dimensional (x, y) vector. More...
#include <ignition/math/Vector2.hh>
Public Member Functions | |
Vector2 () | |
Default Constructor. | |
Vector2 (const T &_x, const T &_y) | |
Constructor. | |
Vector2 (const Vector2< T > &_v) | |
Copy constructor. | |
virtual | ~Vector2 () |
Destructor. | |
double | Distance (const Vector2 &_pt) const |
Calc distance to the given point. | |
T | Dot (const Vector2< T > &_v) const |
Get the dot product of this vector and _v. | |
bool | Equal (const Vector2 &_v, const T &_tol) const |
Equality test with tolerance. | |
bool | IsFinite () const |
See if a point is finite (e.g., not nan) | |
T | Length () const |
Returns the length (magnitude) of the vector. | |
void | Normalize () |
Normalize the vector length. | |
bool | operator!= (const Vector2 &_v) const |
Not equal to operator. | |
const Vector2 | operator* (const Vector2 &_v) const |
Multiplication operators. | |
const Vector2 | operator* (T _v) const |
Multiplication operators. | |
const Vector2 & | operator*= (const Vector2 &_v) |
Multiplication assignment operator. | |
const Vector2 & | operator*= (T _v) |
Multiplication assignment operator. | |
Vector2< T > | operator+ (const T _s) const |
Addition operators. | |
Vector2 | operator+ (const Vector2 &_v) const |
Addition operator. | |
const Vector2< T > & | operator+= (const T _s) |
Addition assignment operator. | |
const Vector2 & | operator+= (const Vector2 &_v) |
Addition assignment operator. | |
Vector2 | operator- () const |
Negation operator. | |
Vector2< T > | operator- (const T _s) const |
Subtraction operators. | |
Vector2 | operator- (const Vector2 &_v) const |
Subtraction operator. | |
const Vector2 & | operator-= (const Vector2 &_v) |
Subtraction assignment operator. | |
const Vector2< T > & | operator-= (T _s) |
Subtraction assignment operator. | |
const Vector2 | operator/ (const Vector2 &_v) const |
Division operator. | |
const Vector2 | operator/ (T _v) const |
Division operator. | |
const Vector2 & | operator/= (const Vector2 &_v) |
Division operator. | |
const Vector2 & | operator/= (T _v) |
Division operator. | |
bool | operator< (const Vector2< T > &_pt) const |
Less than operator. | |
Vector2 & | operator= (const Vector2 &_v) |
Assignment operator. | |
const Vector2 & | operator= (T _v) |
Assignment operator. | |
bool | operator== (const Vector2 &_v) const |
Equal to operator. | |
T & | operator[] (const std::size_t _index) |
Array subscript operator. | |
T | operator[] (const std::size_t _index) const |
Const-qualified array subscript operator. | |
void | Set (T _x, T _y) |
Set the contents of the vector. | |
T | SquaredLength () const |
Returns the square of the length (magnitude) of the vector. | |
T & | X () |
Return a mutable x value. | |
T | X () const |
Return the x value. | |
void | X (const T &_v) |
Set the x value. | |
T & | Y () |
Return a mutable y value. | |
T | Y () const |
Return the y value. | |
void | Y (const T &_v) |
Set the y value. | |
Static Public Attributes | |
static const Vector2< T > | One |
math::Vector2(1, 1) | |
static const Vector2< T > | Zero |
math::Vector2(0, 0) | |
Two dimensional (x, y) vector.
|
inline |
Default Constructor.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator*(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator*(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator+(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator+(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator/(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator/().
|
inline |
Constructor.
[in] | _x | value along x |
[in] | _y | value along y |
|
inline |
Copy constructor.
[in] | _v | the value |
|
inlinevirtual |
Destructor.
|
inline |
Calc distance to the given point.
[in] | _pt | The point to measure to |
|
inline |
Get the dot product of this vector and _v.
[in] | _v | the vector |
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Triangle< T >::Contains().
|
inline |
Equality test with tolerance.
[in] | _v | the vector to compare to |
[in] | _tol | equality tolerance. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::equal().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::operator==().
|
inline |
See if a point is finite (e.g., not nan)
|
inline |
Returns the length (magnitude) of the vector.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::SquaredLength().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Normalize().
|
inline |
Normalize the vector length.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::equal(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Length().
|
inline |
Not equal to operator.
|
inline |
Multiplication operators.
[in] | _v | the vector |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Multiplication operators.
[in] | _v | the scaling factor |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Multiplication assignment operator.
[in] | _v | the vector |
|
inline |
Multiplication assignment operator.
[in] | _v | the scaling factor |
|
inline |
Addition operators.
[in] | _s | the scalar addend |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Addition operator.
[in] | _v | vector to add |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Addition assignment operator.
[in] | _s | scalar addend |
|
inline |
Addition assignment operator.
[in] | _v | the vector to add |
|
inline |
Negation operator.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Subtraction operators.
[in] | _s | the scalar subtrahend |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Subtraction operator.
[in] | _v | the vector to substract |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Subtraction assignment operator.
[in] | _v | the vector to substract |
|
inline |
Subtraction assignment operator.
[in] | _s | scalar subtrahend |
|
inline |
Division operator.
[in] | _v | a vector |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Division operator.
[in] | _v | the value |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Vector2().
|
inline |
Division operator.
[in] | _v | a vector |
|
inline |
Division operator.
[in] | _v | the divisor |
|
inline |
Less than operator.
[in] | _pt | Vector to compare. |
|
inline |
Assignment operator.
[in] | _v | a value for x and y element |
|
inline |
Assignment operator.
[in] | _v | the value for x and y element |
|
inline |
Equal to operator.
[in] | _v | the vector to compare to |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Equal().
|
inline |
Array subscript operator.
[in] | _index | The index, where 0 == x and 1 == y. The index is clamped to the range [0,1]. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_ONE_SIZE_T, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_ZERO_SIZE_T.
|
inline |
Const-qualified array subscript operator.
[in] | _index | The index, where 0 == x and 1 == y. The index is clamped to the range [0,1]. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_ONE_SIZE_T, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_ZERO_SIZE_T.
|
inline |
Set the contents of the vector.
[in] | _x | value along x |
[in] | _y | value along y |
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalAxesOffset().
|
inline |
Returns the square of the length (magnitude) of the vector.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< T >::Length(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::PrincipalAxesOffset().
|
inline |
Return a mutable x value.
|
inline |
Return the x value.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< T >::CrossProduct(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< T >::Intersect(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< T >::Within().
|
inline |
Set the x value.
[in] | _v | Value for the x component. |
|
inline |
Return a mutable y value.
|
inline |
Return the y value.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< T >::CrossProduct(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< T >::Intersect(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< T >::Within().
|
inline |
Set the y value.
[in] | _v | Value for the y component. |
|
static |
math::Vector2(1, 1)
|
static |
math::Vector2(0, 0)