Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Protected Attributes
octomath::Vector3 Class Reference

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 65 of file Vector3.h.

#include <mrpt/otherlibs/octomap/math/Vector3.h>

Public Member Functions

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

Protected Attributes

float data [3]
 

Constructor & Destructor Documentation

◆ Vector3() [1/3]

octomath::Vector3::Vector3 ( )
inline

Default constructor.

Definition at line 71 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 78 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 90 of file Vector3.h.

Member Function Documentation

◆ angleTo()

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

Definition at line 294 of file Vector3.h.

References mrpt::math::norm(), 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

Definition at line 122 of file Vector3.h.

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

◆ distance()

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

Definition at line 302 of file Vector3.h.

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

◆ distanceXY()

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

Definition at line 309 of file Vector3.h.

References mrpt::obs::gnss::pitch, mrpt::obs::gnss::roll, x(), and y().

◆ dot()

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

Definition at line 131 of file Vector3.h.

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

◆ norm()

double octomath::Vector3::norm ( ) const
inline

Definition at line 273 of file Vector3.h.

Referenced by angleTo().

◆ normalize()

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

Definition at line 281 of file Vector3.h.

References mrpt::math::norm().

Referenced by normalized().

◆ normalized()

Vector3 octomath::Vector3::normalized ( ) const
inline

Definition at line 288 of file Vector3.h.

References normalize().

◆ operator()() [1/2]

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

Definition at line 136 of file Vector3.h.

◆ operator()() [2/2]

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

Definition at line 140 of file Vector3.h.

◆ operator*()

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

Definition at line 223 of file Vector3.h.

◆ operator*=()

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

Definition at line 259 of file Vector3.h.

◆ operator+()

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

Definition at line 214 of file Vector3.h.

◆ operator+=()

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

Definition at line 240 of file Vector3.h.

◆ operator-() [1/2]

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

Definition at line 205 of file Vector3.h.

◆ operator-() [2/2]

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

Definition at line 231 of file Vector3.h.

◆ operator-=()

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

Definition at line 247 of file Vector3.h.

◆ operator/=()

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

Definition at line 253 of file Vector3.h.

◆ operator=()

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

Assignment operator.

Parameters
othera vector of dimension 3

Definition at line 106 of file Vector3.h.

◆ operator==()

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

Definition at line 265 of file Vector3.h.

◆ pitch() [1/2]

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

Definition at line 180 of file Vector3.h.

◆ pitch() [2/2]

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

Definition at line 195 of file Vector3.h.

◆ 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

Definition at line 175 of file Vector3.h.

◆ roll() [2/2]

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

Definition at line 190 of file Vector3.h.

◆ rotate_IP()

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

◆ write()

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

◆ writeBinary()

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

◆ x() [1/2]

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

◆ x() [2/2]

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

Definition at line 160 of file Vector3.h.

◆ y() [1/2]

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

◆ y() [2/2]

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

Definition at line 165 of file Vector3.h.

◆ yaw() [1/2]

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

Definition at line 185 of file Vector3.h.

◆ yaw() [2/2]

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

Definition at line 200 of file Vector3.h.

◆ z() [1/2]

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

◆ z() [2/2]

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

Definition at line 170 of file Vector3.h.

Member Data Documentation

◆ data

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

Definition at line 325 of file Vector3.h.




Page generated by Doxygen 1.8.13 for MRPT 1.4.0 SVN: at Tue Jun 20 13:11:55 UTC 2017