octomap  1.9.7
octomath::Vector3 Class Reference

This class represents a three-dimensional vector. More...

Public Member Functions

double angleTo (const Vector3 &other) const
 
Vector3 cross (const Vector3 &other) const
 Three-dimensional vector (cross) product. More...
 
double distance (const Vector3 &other) const
 
double distanceXY (const Vector3 &other) const
 
double dot (const Vector3 &other) const
 dot product More...
 
double norm () const
 
double norm_sq () const
 
Vector3normalize ()
 normalizes this vector, so that it has norm=1.0 More...
 
Vector3 normalized () const
 
float & operator() (unsigned int i)
 
const float & operator() (unsigned int i) const
 
Vector3 operator* (float x) const
 
void operator*= (float x)
 
Vector3 operator+ (const Vector3 &other) const
 
void operator+= (const Vector3 &other)
 
Vector3 operator- () const
 
Vector3 operator- (const Vector3 &other) const
 
void operator-= (const Vector3 &other)
 
void operator/= (float x)
 
Vector3operator= (const Vector3 &other)
 Assignment operator. More...
 
bool operator== (const Vector3 &other) const
 
float & pitch ()
 
const float & pitch () const
 
std::istream & read (std::istream &s)
 
std::istream & readBinary (std::istream &s)
 
float & roll ()
 
const float & roll () const
 
Vector3rotate_IP (double roll, double pitch, double yaw)
 
 Vector3 ()
 Default constructor. More...
 
 Vector3 (const Vector3 &other)
 Copy constructor. More...
 
 Vector3 (float x, float y, float z)
 Constructor. More...
 
std::ostream & write (std::ostream &s) const
 
std::ostream & writeBinary (std::ostream &s) const
 
float & x ()
 
const float & x () const
 
float & y ()
 
const float & y () const
 
float & yaw ()
 
const float & yaw () const
 
float & z ()
 
const float & z () const
 

Protected Attributes

float data [3]
 

Detailed Description

This class represents a three-dimensional vector.

The three-dimensional vector can be used to represent a translation in three-dimensional space or to represent the attitude of an object using Euler angle.

Constructor & Destructor Documentation

◆ Vector3() [1/3]

octomath::Vector3::Vector3 ( )
inline

Default constructor.

References data.

Referenced by cross().

◆ Vector3() [2/3]

octomath::Vector3::Vector3 ( const Vector3 other)
inline

Copy constructor.

Parameters
othera vector of dimension 3

References data.

◆ Vector3() [3/3]

octomath::Vector3::Vector3 ( float  x,
float  y,
float  z 
)
inline

Constructor.

Constructs a three-dimensional vector from three single values x, y, z or roll, pitch, yaw

References data, x(), y(), and z().

Member Function Documentation

◆ angleTo()

double octomath::Vector3::angleTo ( const Vector3 other) const
inline

References dot(), and norm().

◆ cross()

Vector3 octomath::Vector3::cross ( const Vector3 other) const
inline

Three-dimensional vector (cross) product.

Calculates the tree-dimensional cross product, which represents the vector orthogonal to the plane defined by this and other.

Returns
this x other

References Vector3(), x(), y(), and z().

Referenced by octomap::OccupancyOcTreeBase< OcTreeNodeStamped >::getNormals().

◆ distance()

double octomath::Vector3::distance ( const Vector3 other) const
inline

References x(), y(), and z().

Referenced by octomap::MapCollection< MAPNODE >::castRay().

◆ distanceXY()

double octomath::Vector3::distanceXY ( const Vector3 other) const
inline

References x(), and y().

◆ dot()

double octomath::Vector3::dot ( const Vector3 other) const
inline

◆ norm()

double octomath::Vector3::norm ( ) const
inline
Returns
length of the vector ("L2 norm")

References norm_sq().

Referenced by angleTo(), octomap::OcTreeBaseImpl< ColorOcTreeNode, AbstractOccupancyOcTree >::computeRayKeys(), and normalize().

◆ norm_sq()

double octomath::Vector3::norm_sq ( ) const
inline
Returns
squared length ("L2 norm") of the vector

References x(), y(), and z().

Referenced by norm().

◆ normalize()

Vector3& octomath::Vector3::normalize ( )
inline

normalizes this vector, so that it has norm=1.0

References norm().

Referenced by octomap::OccupancyOcTreeBase< OcTreeNodeStamped >::getNormals(), and normalized().

◆ normalized()

Vector3 octomath::Vector3::normalized ( ) const
inline
Returns
normalized vector, this one remains unchanged

References normalize().

Referenced by octomap::OccupancyOcTreeBase< OcTreeNodeStamped >::castRay().

◆ operator()() [1/2]

float& octomath::Vector3::operator() ( unsigned int  i)
inline

References data.

◆ operator()() [2/2]

const float& octomath::Vector3::operator() ( unsigned int  i) const
inline

References data.

Referenced by pitch(), readBinary(), roll(), writeBinary(), x(), y(), yaw(), and z().

◆ operator*()

Vector3 octomath::Vector3::operator* ( float  x) const
inline

References x().

◆ operator*=()

void octomath::Vector3::operator*= ( float  x)
inline

References data, and x().

◆ operator+()

Vector3 octomath::Vector3::operator+ ( const Vector3 other) const
inline

◆ operator+=()

void octomath::Vector3::operator+= ( const Vector3 other)
inline

References data.

◆ operator-() [1/2]

Vector3 octomath::Vector3::operator- ( ) const
inline

References data.

◆ operator-() [2/2]

Vector3 octomath::Vector3::operator- ( const Vector3 other) const
inline

◆ operator-=()

void octomath::Vector3::operator-= ( const Vector3 other)
inline

References data.

◆ operator/=()

void octomath::Vector3::operator/= ( float  x)
inline

References data, and x().

◆ operator=()

Vector3& octomath::Vector3::operator= ( const Vector3 other)
inline

Assignment operator.

Parameters
othera vector of dimension 3

References data.

◆ operator==()

bool octomath::Vector3::operator== ( const Vector3 other) const
inline

◆ pitch() [1/2]

float& octomath::Vector3::pitch ( )
inline

◆ pitch() [2/2]

const float& octomath::Vector3::pitch ( ) const
inline

References operator()().

◆ read()

std::istream & octomath::Vector3::read ( std::istream &  s)

◆ readBinary()

std::istream & octomath::Vector3::readBinary ( std::istream &  s)

◆ roll() [1/2]

float& octomath::Vector3::roll ( )
inline

◆ roll() [2/2]

const float& octomath::Vector3::roll ( ) const
inline

References operator()().

◆ rotate_IP()

Vector3 & octomath::Vector3::rotate_IP ( double  roll,
double  pitch,
double  yaw 
)

References pitch(), roll(), x(), y(), yaw(), and z().

Referenced by generateSphereTree(), and main().

◆ write()

std::ostream & octomath::Vector3::write ( std::ostream &  s) const

◆ writeBinary()

std::ostream & octomath::Vector3::writeBinary ( std::ostream &  s) const

References operator()().

Referenced by octomath::Pose6D::writeBinary().

◆ x() [1/2]

◆ x() [2/2]

const float& octomath::Vector3::x ( ) const
inline

References operator()().

◆ y() [1/2]

◆ y() [2/2]

const float& octomath::Vector3::y ( ) const
inline

References operator()().

◆ yaw() [1/2]

float& octomath::Vector3::yaw ( )
inline

◆ yaw() [2/2]

const float& octomath::Vector3::yaw ( ) const
inline

References operator()().

◆ z() [1/2]

◆ z() [2/2]

const float& octomath::Vector3::z ( ) const
inline

References operator()().

Field Documentation

◆ data

float octomath::Vector3::data[3]
protected

The documentation for this class was generated from the following files: