Public Member Functions | Protected Attributes | List of all members
octomath::Vector3 Class Reference

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

#include <Vector3.h>

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)
 
bool operator< (const Vector3 &other) const
 
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.

Definition at line 50 of file Vector3.h.

Constructor & Destructor Documentation

◆ Vector3() [1/3]

octomath::Vector3::Vector3 ( )
inline

Default constructor.

Definition at line 56 of file Vector3.h.

◆ Vector3() [2/3]

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

Copy constructor.

Parameters
othera vector of dimension 3

Definition at line 63 of file Vector3.h.

◆ 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

Definition at line 75 of file Vector3.h.

Member Function Documentation

◆ angleTo()

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

Definition at line 295 of file Vector3.h.

◆ 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

Definition at line 107 of file Vector3.h.

◆ distance()

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

Definition at line 303 of file Vector3.h.

◆ distanceXY()

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

Definition at line 310 of file Vector3.h.

◆ dot()

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

dot product

Definition at line 117 of file Vector3.h.

◆ norm()

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

Definition at line 271 of file Vector3.h.

◆ norm_sq()

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

Definition at line 276 of file Vector3.h.

◆ normalize()

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

normalizes this vector, so that it has norm=1.0

Definition at line 281 of file Vector3.h.

◆ normalized()

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

Definition at line 289 of file Vector3.h.

◆ operator()() [1/2]

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

Definition at line 126 of file Vector3.h.

◆ operator()() [2/2]

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

Definition at line 122 of file Vector3.h.

◆ operator*()

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

Definition at line 209 of file Vector3.h.

◆ operator*=()

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

Definition at line 245 of file Vector3.h.

◆ operator+()

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

Definition at line 200 of file Vector3.h.

◆ operator+=()

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

Definition at line 226 of file Vector3.h.

◆ operator-() [1/2]

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

Definition at line 191 of file Vector3.h.

◆ operator-() [2/2]

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

Definition at line 217 of file Vector3.h.

◆ operator-=()

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

Definition at line 233 of file Vector3.h.

◆ operator/=()

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

Definition at line 239 of file Vector3.h.

◆ operator<()

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

Definition at line 259 of file Vector3.h.

◆ operator=()

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

Assignment operator.

Parameters
othera vector of dimension 3

Definition at line 91 of file Vector3.h.

◆ operator==()

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

Definition at line 251 of file Vector3.h.

◆ pitch() [1/2]

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

Definition at line 166 of file Vector3.h.

◆ pitch() [2/2]

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

Definition at line 181 of file Vector3.h.

◆ read()

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

Definition at line 69 of file Vector3.cpp.

◆ readBinary()

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

Definition at line 87 of file Vector3.cpp.

◆ roll() [1/2]

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

Definition at line 161 of file Vector3.h.

◆ roll() [2/2]

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

Definition at line 176 of file Vector3.h.

◆ rotate_IP()

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

Definition at line 41 of file Vector3.cpp.

◆ write()

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

Definition at line 78 of file Vector3.cpp.

◆ writeBinary()

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

Definition at line 99 of file Vector3.cpp.

◆ x() [1/2]

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

Definition at line 131 of file Vector3.h.

◆ x() [2/2]

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

Definition at line 146 of file Vector3.h.

◆ y() [1/2]

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

Definition at line 136 of file Vector3.h.

◆ y() [2/2]

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

Definition at line 151 of file Vector3.h.

◆ yaw() [1/2]

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

Definition at line 171 of file Vector3.h.

◆ yaw() [2/2]

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

Definition at line 186 of file Vector3.h.

◆ z() [1/2]

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

Definition at line 141 of file Vector3.h.

◆ z() [2/2]

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

Definition at line 156 of file Vector3.h.

Member Data Documentation

◆ data

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

Definition at line 326 of file Vector3.h.


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


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Tue Dec 12 2023 03:39:41