The Vector3 class represents the generic vector containing 3 elements. More...
#include <math/gzmath.hh>
Public Member Functions | |
Vector3 () | |
Constructor. More... | |
Vector3 (const double &_x, const double &_y, const double &_z) | |
Constructor. More... | |
Vector3 (const ignition::math::Vector3d &_v) | |
Ignition math copy constructor. More... | |
Vector3 (const Vector3 &_v) | |
Copy constructor. More... | |
virtual | ~Vector3 () |
Destructor. More... | |
void | Correct () |
Corrects any nan values. More... | |
Vector3 | Cross (const Vector3 &_pt) const |
Return the cross product of this vector and pt. More... | |
double | Distance (const Vector3 &_pt) const |
Calc distance to the given point. More... | |
double | Distance (double _x, double _y, double _z) const |
Calc distance to the given point. More... | |
double | Dot (const Vector3 &_pt) const |
Return the dot product of this vector and pt. More... | |
bool | Equal (const Vector3 &_v) const |
Equality test. More... | |
Vector3 | GetAbs () const |
Get the absolute value of the vector. More... | |
double | GetDistToLine (const Vector3 &_pt1, const Vector3 &_pt2) |
Get distance to a line. More... | |
double | GetLength () const |
Returns the length (magnitude) of the vector \ return the length. More... | |
double | GetMax () const |
Get the maximum value in the vector. More... | |
double | GetMin () const |
Get the minimum value in the vector. More... | |
Vector3 | GetPerpendicular () const |
Return a vector that is perpendicular to this one. More... | |
Vector3 | GetRounded () const |
Get a rounded version of this vector. More... | |
double | GetSquaredLength () const |
Return the square of the length (magnitude) of the vector. More... | |
double | GetSum () const |
Return the sum of the values. More... | |
ignition::math::Vector3d | Ign () const |
Convert this vector to an ignition::math::Vector3d. More... | |
bool | IsFinite () const |
See if a point is finite (e.g., not nan) More... | |
Vector3 | Normalize () |
Normalize the vector length. More... | |
bool | operator!= (const Vector3 &_v) const |
Not equal to operator. More... | |
Vector3 | operator* (const Vector3 &_p) const |
Multiplication operator. More... | |
Vector3 | operator* (double _v) const |
Multiplication operators. More... | |
const Vector3 & | operator*= (const Vector3 &_v) |
Multiplication operators. More... | |
const Vector3 & | operator*= (double _v) |
Multiplication operator. More... | |
Vector3 | operator+ (const Vector3 &_v) const |
Addition operator. More... | |
const Vector3 & | operator+= (const Vector3 &_v) |
Addition assignment operator. More... | |
Vector3 | operator- () const |
Negation operator. More... | |
Vector3 | operator- (const Vector3 &_pt) const |
Subtraction operators. More... | |
const Vector3 & | operator-= (const Vector3 &_pt) |
Subtraction operators. More... | |
const Vector3 | operator/ (const Vector3 &_pt) const |
Division operator. More... | |
const Vector3 | operator/ (double _v) const |
Division operator. More... | |
const Vector3 & | operator/= (const Vector3 &_pt) |
Division assignment operator. More... | |
const Vector3 & | operator/= (double _v) |
Division operator. More... | |
Vector3 & | operator= (const ignition::math::Vector3d &_v) |
Assignment operator for ignition math. More... | |
Vector3 & | operator= (const Vector3 &_v) |
Assignment operator. More... | |
Vector3 & | operator= (double _value) |
Assignment operator. More... | |
bool | operator== (const Vector3 &_pt) const |
Equal to operator. More... | |
double | operator[] (unsigned int index) const |
[] operator More... | |
Vector3 | Round () |
Round to near whole number, return the result. More... | |
void | Round (int _precision) |
Round all values to _precision decimal places. More... | |
void | Set (double _x=0, double _y=0, double _z=0) |
Set the contents of the vector. More... | |
void | SetToMax (const Vector3 &_v) |
Set this vector's components to the maximum of itself and the passed in vector. More... | |
void | SetToMin (const Vector3 &_v) |
Set this vector's components to the minimum of itself and the passed in vector. More... | |
Static Public Member Functions | |
static Vector3 | GetNormal (const Vector3 &_v1, const Vector3 &_v2, const Vector3 &_v3) |
Get a normal vector to a triangle. More... | |
Public Attributes | |
double | x |
X location. More... | |
double | y |
Y location. More... | |
double | z |
Z location. 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 | operator* (double _s, const Vector3 &_v) |
Multiplication operators. More... | |
std::ostream & | operator<< (std::ostream &_out, const gazebo::math::Vector3 &_pt) |
Stream insertion operator. More... | |
std::istream & | operator>> (std::istream &_in, gazebo::math::Vector3 &_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.
Vector3 | ( | ) |
Constructor.
Referenced by Vector3::operator-().
Vector3 | ( | const double & | _x, |
const double & | _y, | ||
const double & | _z | ||
) |
Constructor.
[in] | _x | value along x |
[in] | _y | value along y |
[in] | _z | value along z |
Vector3 | ( | const ignition::math::Vector3d & | _v | ) |
Ignition math copy constructor.
[in] | _v | a vector |
|
virtual |
Destructor.
|
inline |
Corrects any nan values.
References Vector3::Equal(), Vector3::operator[](), Vector3::Round(), Vector3::x, Vector3::y, and Vector3::z.
Referenced by Pose::Correct().
double Distance | ( | const Vector3 & | _pt | ) | const |
Calc distance to the given point.
[in] | _pt | the point |
double Distance | ( | double | _x, |
double | _y, | ||
double | _z | ||
) | const |
Calc distance to the given point.
[in] | _x | value along x |
[in] | _y | value along y |
[in] | _z | value along z |
double Dot | ( | const Vector3 & | _pt | ) | const |
bool Equal | ( | const Vector3 & | _v | ) | const |
Equality test.
[in] | _v | the other vector |
Referenced by Vector3::Correct().
Vector3 GetAbs | ( | ) | const |
Get the absolute value of the vector.
Referenced by Vector3::Set().
Get distance to a line.
[in] | _pt1 | first point on the line |
[in] | _pt2 | second point on the line |
Referenced by Vector3::Set().
double GetLength | ( | ) | const |
Returns the length (magnitude) of the vector \ return the length.
double GetMax | ( | ) | const |
double GetMin | ( | ) | const |
Get a normal vector to a triangle.
[in] | _v1 | first vertex of the triangle |
[in] | _v2 | second vertex |
[in] | _v3 | third vertex |
Referenced by Vector3::Set().
Vector3 GetPerpendicular | ( | ) | const |
Return a vector that is perpendicular to this one.
Referenced by Vector3::Set().
Vector3 GetRounded | ( | ) | const |
Get a rounded version of this vector.
double GetSquaredLength | ( | ) | const |
Return the square of the length (magnitude) of the vector.
double GetSum | ( | ) | const |
Return the sum of the values.
ignition::math::Vector3d Ign | ( | ) | const |
Convert this vector to an ignition::math::Vector3d.
Referenced by Vector3::Set().
bool IsFinite | ( | ) | const |
See if a point is finite (e.g., not nan)
Vector3 Normalize | ( | ) |
Normalize the vector length.
bool operator!= | ( | const Vector3 & | _v | ) | const |
Not equal to operator.
[in] | _v | The vector to compare against |
Multiplication operator.
[in] | _v |
Referenced by Vector3::operator-().
Vector3 operator* | ( | double | _v | ) | const |
Multiplication operators.
[in] | _v | the scaling factor |
Multiplication operators.
[in] | _v | a vector |
Referenced by Vector3::operator-().
const Vector3& operator*= | ( | double | _v | ) |
Multiplication operator.
[in] | _v | scaling factor |
Addition operator.
[in] | _v | vector to add |
Referenced by Vector3::Set().
|
inline |
Negation operator.
References Vector3::Vector3(), Vector3::x, Vector3::y, and Vector3::z.
Subtraction operators.
[in] | _pt | a vector to substract |
References Vector3::operator*(), Vector3::operator*=(), Vector3::operator-=(), Vector3::operator/(), Vector3::operator/=(), Vector3::Vector3(), Vector3::x, Vector3::y, and Vector3::z.
Division operator.
[in] _pt the vector divisor
Referenced by Vector3::operator-().
const Vector3 operator/ | ( | double | _v | ) | const |
Division operator.
Division assignment operator.
[in] _pt the vector divisor
Referenced by Vector3::operator-().
const Vector3& operator/= | ( | double | _v | ) |
Division operator.
Vector3& operator= | ( | const ignition::math::Vector3d & | _v | ) |
Assignment operator for ignition math.
[in] | _v | a new value |
Referenced by Vector3::Set().
Assignment operator.
[in] | _v | a new value |
Vector3& operator= | ( | double | _value | ) |
Assignment operator.
[in] | _value | assigned to all elements |
bool operator== | ( | const Vector3 & | _pt | ) | const |
Equal to operator.
[in] | _pt | The vector to compare against |
double operator[] | ( | unsigned int | index | ) | const |
[] operator
Referenced by Vector3::Correct().
Vector3 Round | ( | ) |
void Round | ( | int | _precision | ) |
Round all values to _precision decimal places.
[in] | _precision | the decimal places |
|
inline |
Set the contents of the vector.
[in] | _x | value along x |
[in] | _y | value along y |
[in] | _z | value aling z |
References Vector3::Cross(), Vector3::Dot(), Vector3::GetAbs(), Vector3::GetDistToLine(), Vector3::GetMax(), Vector3::GetMin(), Vector3::GetNormal(), Vector3::GetPerpendicular(), Vector3::Ign(), Vector3::operator+(), Vector3::operator+=(), Vector3::operator=(), Vector3::SetToMax(), Vector3::SetToMin(), Vector3::x, Vector3::y, and Vector3::z.
void SetToMax | ( | const Vector3 & | _v | ) |
Set this vector's components to the maximum of itself and the passed in vector.
[in] | _v | the maximum clamping vector |
Referenced by Vector3::Set().
void SetToMin | ( | const Vector3 & | _v | ) |
Set this vector's components to the minimum of itself and the passed in vector.
[in] | _v | the minimum clamping vector |
Referenced by Vector3::Set().
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)
Referenced by ServerFixture::CheckPointer().
double x |
X location.
Referenced by BulletTypes::ConvertVector3(), DARTTypes::ConvVec3(), Pose::CoordPositionSub(), Vector3::Correct(), ODEPlaneShape::CreatePlane(), Matrix3::operator*(), Vector3::operator-(), Quaternion::RotateVector(), Vector3::Set(), ODEPlaneShape::SetAltitude(), BulletSphereShape::SetRadius(), SimbodyBoxShape::SetSize(), BulletBoxShape::SetSize(), ODEBoxShape::SetSize(), and BulletCylinderShape::SetSize().
double y |
Y location.
Referenced by BulletTypes::ConvertVector3(), DARTTypes::ConvVec3(), Pose::CoordPositionSub(), Vector3::Correct(), ODEPlaneShape::CreatePlane(), Matrix3::operator*(), Vector3::operator-(), Quaternion::RotateVector(), Vector3::Set(), ODEPlaneShape::SetAltitude(), BulletSphereShape::SetRadius(), SimbodyBoxShape::SetSize(), BulletBoxShape::SetSize(), ODEBoxShape::SetSize(), and BulletCylinderShape::SetSize().
double z |
Z location.
Referenced by BulletTypes::ConvertVector3(), DARTTypes::ConvVec3(), Pose::CoordPositionSub(), Vector3::Correct(), ODEPlaneShape::CreatePlane(), Matrix3::operator*(), Vector3::operator-(), Quaternion::RotateVector(), Vector3::Set(), ODEPlaneShape::SetAltitude(), BulletSphereShape::SetRadius(), SimbodyBoxShape::SetSize(), BulletBoxShape::SetSize(), ODEBoxShape::SetSize(), and BulletCylinderShape::SetSize().
|
static |
math::Vector3(0, 0, 0)
Referenced by Link::GetWorldLinearVel().