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< int >::operator*, ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator*(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator*(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator+(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator+(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator/(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::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< int >::Contains().
|
inline |
Equality test with tolerance.
| [in] | _v | the vector to compare to |
| [in] | _tol | equality tolerance. |
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator==().
|
inline |
See if a point is finite (e.g., not nan)
|
inline |
Returns the length (magnitude) of the vector.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::Normalize().
|
inline |
Normalize the vector length.
|
inline |
Not equal to operator.
|
inline |
Multiplication operators.
| [in] | _v | the vector |
|
inline |
Multiplication operators.
| [in] | _v | the scaling factor |
|
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 |
|
inline |
Addition operator.
| [in] | _v | vector to add |
|
inline |
Addition assignment operator.
| [in] | _s | scalar addend |
|
inline |
Addition assignment operator.
| [in] | _v | the vector to add |
|
inline |
Negation operator.
|
inline |
Subtraction operators.
| [in] | _s | the scalar subtrahend |
|
inline |
Subtraction operator.
| [in] | _v | the vector to substract |
|
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 |
|
inline |
Division operator.
| [in] | _v | the value |
|
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 |
|
inline |
Array subscript operator.
| [in] | _index | The index, where 0 == x and 1 == y. The index is clamped to the range [0,1]. |
|
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]. |
|
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::Vector2< int >::operator>>, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< double >::PrincipalAxesOffset().
|
inline |
Returns the square of the length (magnitude) of the vector.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::Length(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< double >::PrincipalAxesOffset().
|
inline |
Return a mutable x value.
|
inline |
Return the x value.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< int >::CrossProduct(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< int >::Intersect(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator-, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< int >::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< int >::CrossProduct(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< int >::Intersect(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector2< int >::operator-, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Line2< int >::Within().
|
inline |
Set the y value.
| [in] | _v | Value for the y component. |
|
static |
math::Vector2(1, 1)
|
static |
math::Vector2(0, 0)