modm API documentation
modm::Vector< T, N > Class Template Reference

Class for handling common point operations. More...

#include <modm/math/geometry/vector.hpp>

Public Member Functions

 Vector (const T *ptData)
 
 Vector (const Matrix< T, N, 1 > &rhs)
 
Vector & operator= (const Matrix< T, N, 1 > &rhs)
 
bool operator== (const Vector &rhs) const
 
bool operator!= (const Vector &rhs) const
 
bool operator< (const Vector &rhs) const
 
bool operator<= (const Vector &rhs) const
 
bool operator> (const Vector &rhs) const
 
bool operator>= (const Vector &rhs) const
 
const T & operator[] (uint8_t index) const
 
T & operator[] (uint8_t index)
 
T * ptr ()
 
const T * ptr () const
 
Vector operator+ (const Vector &rhs) const
 
Vector operator- (const Vector &rhs) const
 
operator* (const Vector &rhs) const
 
Vector operator* (const T &rhs) const
 
Vector operator/ (const T &rhs) const
 
Vector & operator+= (const Vector &rhs)
 
Vector & operator-= (const Vector &rhs)
 
Vector & operator*= (const T &rhs)
 
Vector & operator/= (const T &rhs)
 
Vector & operator- ()
 
getLength () const
 
getLengthSquared () const
 
Matrix< T, N, 1 > & asMatrix ()
 
const Matrix< T, N, 1 > & asMatrix () const
 
Matrix< T, 1, N > & asTransposedMatrix ()
 
const Matrix< T, 1, N > & asTransposedMatrix () const
 
int16_t getLength () const
 
int32_t getLengthSquared () const
 
int32_t dot (const modm::Vector< int16_t, 2 > &other) const
 
Vector< double, 2 > convert () const
 
Vector< float, 2 > convert () const
 
int16_t getLength () const
 
int32_t getLengthSquared () const
 
int32_t dot (const modm::Vector< int16_t, 2 > &other) const
 
Vector< double, 2 > convert () const
 
Vector< float, 2 > convert () const
 
Vector< U, 2 > convert () const
 
Vector< U, 2 > convert () const
 

Static Public Member Functions

static uint8_t getSize ()
 

Public Attributes

coords [N]
 

Detailed Description

template<typename T, uint8_t N>
class modm::Vector< T, N >

Class for handling common point operations.

Basic data type of all geometric operations. Used to represent vectors as well as particular points in the coordinate system.

Point vs. vector

In geometry, it is often convenient to use vector arithmetic to represent points.

A vector, by its definition, has no fixed starting point, but if we imagine the starting point of a vector to be the origin, then the endpoint of the vector represents a particular point.

In this manner, every vector can be said to identify a unique point, which is the endpoint of the vector when its starting point is the origin.

Therefore there isn't a Point-class, but only a Vector class.

Adapted from the implementation of Gaspard Petit (gaspardpetit@gmail.com).

See also
<a href"http://www-etud.iro.umontreal.ca/~petitg/cpp/point.html">Homepage
Author
Niklas Hauser

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