Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::HomVector Class Reference

A homogeneous vector. More...

#include <geometry/hom_vector.h>

Inheritance diagram for fawkes::HomVector:

Public Member Functions

 HomVector (float x=0, float y=0, float z=0)
 Constructor. More...
 
 HomVector (const HomCoord &h)
 Constructor. More...
 
virtual ~HomVector ()
 Destructor. More...
 
float length () const
 Calculates the length of the vector. More...
 
float length_square () const
 Calculates the squared length length of the vector (faster than length. More...
 
HomVectorset_length (float length)
 Scales the vector such that it has the given length. More...
 
HomVectorunit ()
 Brings the vector to unit-length. More...
 
float angle_xy (const HomVector &h) const
 Compute the angle between two vectors. More...
 
- Public Member Functions inherited from fawkes::HomCoord
 HomCoord (const HomCoord &c)
 Copy constructor. More...
 
virtual ~HomCoord ()
 Destructor. More...
 
virtual float x () const
 RO-getter for x. More...
 
virtual float & x ()
 RW-getter for x. More...
 
virtual HomCoordx (float x)
 Setter function for x. More...
 
virtual float y () const
 RO-getter for y. More...
 
virtual float & y ()
 RW-getter for y. More...
 
virtual HomCoordy (float y)
 Setter function for y. More...
 
virtual float z () const
 RO-getter for z. More...
 
virtual float & z ()
 RW-getter for z. More...
 
virtual HomCoordz (float z)
 Setter function for z. More...
 
virtual float w () const
 RO-getter for w. More...
 
virtual float & w ()
 RW-getter for w. More...
 
virtual HomCoordw (float w)
 Setter function for w. More...
 
virtual HomCoordrotate_x (float rad)
 Convenience function to rotate the HomCoord around the x-axis. More...
 
virtual HomCoordrotate_y (float rad)
 Convenience function to rotate the HomCoord around the y-axis. More...
 
virtual HomCoordrotate_z (float rad)
 Convenience function to rotate the HomCoord around the z-axis. More...
 
HomCoordtransform (const HomTransform &t)
 Transform the vector with the given transform. More...
 
virtual HomCoord operator- (const HomCoord &h) const
 Subtraction operator. More...
 
virtual HomCoordoperator-= (const HomCoord &h)
 Substraction-assignment operator. More...
 
virtual HomCoord operator+ (const HomCoord &h) const
 Addition operator. More...
 
virtual HomCoordoperator+= (const HomCoord &h)
 Addition-assignment operator. More...
 
virtual float operator* (const HomCoord &h) const
 Calculates the dot product of two coords. More...
 
virtual HomCoord operator* (const float s) const
 Mulitplication operator. More...
 
virtual HomCoordoperator*= (const float s)
 Multiplication-assignment operator. More...
 
virtual HomCoordoperator= (const HomCoord &h)
 Assignment operator. More...
 
virtual bool operator== (const HomCoord &h) const
 Comparison operator. More...
 
virtual bool operator!= (const HomCoord &h) const
 Inequality operator. More...
 
- Public Member Functions inherited from fawkes::Printable
 Printable ()
 Constructor. More...
 
virtual ~Printable ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fawkes::HomCoord
 HomCoord (float x=0.0, float y=0.0, float z=0.0, float w=0.0)
 Constructor. More...
 
 HomCoord (const Vector &v)
 Constructor. More...
 
virtual std::ostream & print (std::ostream &stream) const
 Appends the components of the HomCoord to the ostream. More...
 
- Protected Attributes inherited from fawkes::HomCoord
Vectorm_vector
 The internal data container. More...
 

Detailed Description

A homogeneous vector.

Author
Daniel Beck

Definition at line 31 of file hom_vector.h.

Constructor & Destructor Documentation

fawkes::HomVector::HomVector ( float  x = 0,
float  y = 0,
float  z = 0 
)

Constructor.

Parameters
xthe x-coordinate
ythe y-coordinate
zthe z-coordinate

Definition at line 41 of file hom_vector.cpp.

fawkes::HomVector::HomVector ( const HomCoord h)

Constructor.

Parameters
ha HomCoord

Definition at line 49 of file hom_vector.cpp.

References fawkes::HomCoord::w().

fawkes::HomVector::~HomVector ( )
virtual

Destructor.

Definition at line 61 of file hom_vector.cpp.

Member Function Documentation

float fawkes::HomVector::angle_xy ( const HomVector v) const

Compute the angle between two vectors.

Parameters
vthe other vector
Returns
the angle (-M_PI ... M_PI)

Definition at line 117 of file hom_vector.cpp.

References length(), fawkes::HomCoord::x(), and fawkes::HomCoord::y().

float fawkes::HomVector::length ( ) const

Calculates the length of the vector.

Returns
the length

Definition at line 69 of file hom_vector.cpp.

References length_square().

Referenced by angle_xy(), fawkes::LineSegment::length(), and set_length().

float fawkes::HomVector::length_square ( ) const

Calculates the squared length length of the vector (faster than length.

Returns
the squared length

Definition at line 78 of file hom_vector.cpp.

References fawkes::HomCoord::x(), fawkes::HomCoord::y(), and fawkes::HomCoord::z().

Referenced by length().

HomVector & fawkes::HomVector::set_length ( float  length)

Scales the vector such that it has the given length.

Parameters
lengththe new length
Returns
reference to a vector with given length

Definition at line 99 of file hom_vector.cpp.

References length(), fawkes::HomCoord::x(), fawkes::HomCoord::y(), and fawkes::HomCoord::z().

Referenced by fawkes::HomPolar::r(), and unit().

HomVector & fawkes::HomVector::unit ( )

Brings the vector to unit-length.

Returns
a reference to itself

Definition at line 87 of file hom_vector.cpp.

References set_length().

Referenced by fawkes::HomPose2d::HomPose2d().


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