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