Atmel Software Framework

math::vector2d Class Reference

Ordered 2-tuple implementing Euclidean vector operations.

#include <vector.h>

Public Member Functions

class construction and destruction
 vector2d (scalar x=0, scalar y=0)
 
class public methods
const scalar dot (const vector2d &v) const
 
void normalize ()
 
const scalar mag () const
 
const vector2d unit () const
 
bool nearlyEquals (const vector2d &v, const scalar &e) const
 
class member operators
scalaroperator() (int i)
 
const scalaroperator() (int i) const
 
scalaroperator[] (int i)
 
const scalaroperator[] (int i) const
 
const vector2doperator+= (const vector2d &v)
 
const vector2doperator-= (const vector2d &v)
 
const vector2doperator*= (const scalar &s)
 
const vector2doperator/= (const scalar &s)
 
const vector2d operator+ (const vector2d &v) const
 
const vector2d operator- (const vector2d &v) const
 
const vector2d operator* (const scalar &s) const
 
const vector2d operator/ (const scalar &s) const
 
bool operator== (const vector2d &v) const
 
bool operator!= (const vector2d &v) const
 

Data Fields

vector element storage
scalar x
 
scalar y
 

Friends

class friend operators
const vector2d operator* (const scalar &s, const vector2d &v)
 
const vector2d operator- (const vector2d &u)
 

math::vector2d::vector2d ( scalar  x = 0,
scalar  y = 0 
)
inlineexplicit

const scalar math::vector2d::dot ( const vector2d v) const
inline

References x, and y.

Referenced by mag().

const scalar math::vector2d::mag ( ) const
inline

References dot().

Referenced by normalize(), and unit().

bool math::vector2d::nearlyEquals ( const vector2d v,
const scalar e 
) const
inline

References x, and y.

void math::vector2d::normalize ( )
inline

References mag().

bool math::vector2d::operator!= ( const vector2d v) const
inline
scalar& math::vector2d::operator() ( int  i)
inline

References i, and x.

Referenced by operator[]().

const scalar& math::vector2d::operator() ( int  i) const
inline

References i, and x.

const vector2d math::vector2d::operator* ( const scalar s) const
inline

References vector2d(), x, and y.

const vector2d& math::vector2d::operator*= ( const scalar s)
inline

References s, x, and y.

const vector2d math::vector2d::operator+ ( const vector2d v) const
inline

References vector2d(), x, and y.

const vector2d& math::vector2d::operator+= ( const vector2d v)
inline

References x, and y.

const vector2d math::vector2d::operator- ( const vector2d v) const
inline

References vector2d(), x, and y.

const vector2d& math::vector2d::operator-= ( const vector2d v)
inline

References x, and y.

const vector2d math::vector2d::operator/ ( const scalar s) const
inline

References vector2d(), x, and y.

const vector2d& math::vector2d::operator/= ( const scalar s)
inline

References s, x, and y.

bool math::vector2d::operator== ( const vector2d v) const
inline

References x, and y.

scalar& math::vector2d::operator[] ( int  i)
inline

References operator()().

const scalar& math::vector2d::operator[] ( int  i) const
inline

References operator()().

const vector2d math::vector2d::unit ( ) const
inline

References mag().

const vector2d operator* ( const scalar s,
const vector2d v 
)
friend
const vector2d operator- ( const vector2d u)
friend