octomap 1.9.8
Loading...
Searching...
No Matches
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.
double distance (const Vector3 &other) const
double distanceXY (const Vector3 &other) const
double dot (const Vector3 &other) const
 dot product
double norm () const
double norm_sq () const
Vector3normalize ()
 normalizes this vector, so that it has norm=1.0
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.
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.
 Vector3 (const Vector3 &other)
 Copy constructor.
 Vector3 (float x, float y, float z)
 Constructor.
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

◆ Vector3() [2/3]

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

Copy constructor.

Parameters
othera vector of dimension 3

References data, and Vector3().

◆ 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(), norm(), and Vector3().

◆ 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< NODE >::getNormals().

◆ distance()

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

◆ distanceXY()

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

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

◆ dot()

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

dot product

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

Referenced by angleTo(), and octomap::OccupancyOcTreeBase< NODE >::getRayIntersection().

◆ norm()

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

References norm_sq().

Referenced by angleTo(), octomap::OcTreeBaseImpl< NODE, INTERFACE >::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(), and Vector3().

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

◆ normalized()

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

References normalize(), and Vector3().

Referenced by octomap::OccupancyOcTreeBase< NODE >::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(), pitch(), readBinary(), roll(), roll(), writeBinary(), x(), x(), y(), y(), yaw(), yaw(), z(), and z().

◆ operator*()

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

References Vector3(), and x().

◆ operator*=()

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

References data, and x().

◆ operator+()

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

References Vector3().

◆ operator+=()

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

References data, and Vector3().

◆ operator-() [1/2]

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

References data, and Vector3().

◆ operator-() [2/2]

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

References Vector3().

◆ operator-=()

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

References data, and Vector3().

◆ 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, and Vector3().

◆ operator==()

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

References Vector3().

◆ 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)

References operator()().

Referenced by octomap::Pointcloud::readBinary().

◆ 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(), Vector3(), x(), y(), yaw(), and z().

Referenced by generateSphereTree(), main(), and main().

◆ write()

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

◆ writeBinary()

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

References operator()().

◆ 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: