#include <BALL/MATHS/vector2.h>
Public Member Functions | |
Constructors and Destructors | |
TVector2 () | |
TVector2 (const T &value) | |
TVector2 (const T &vx, const T &vy) | |
TVector2 (const TVector2 &vector) | |
TVector2 (const T *ptr) throw (Exception::NullPointer) | |
virtual | ~TVector2 () |
virtual void | clear () |
Persistence | |
virtual void | persistentWrite (PersistenceManager &pm, const char *name=0) const throw (Exception::GeneralException) |
virtual void | persistentRead (PersistenceManager &pm) throw (Exception::GeneralException) |
Arithmetic operators | |
const TVector2 & | operator+ () const |
TVector2 | operator- () const |
TVector2 | operator+ (const TVector2 &b) const |
TVector2 | operator- (const TVector2 &b) const |
TVector2 & | operator+= (const TVector2 &vector) |
TVector2 & | operator-= (const TVector2 &vector) |
TVector2 | operator* (const T &scalar) const |
TVector2 & | operator*= (const T &scalar) |
TVector2 | operator/ (const T &lambda) const throw (Exception::DivisionByZero) |
TVector2 & | operator/= (const T &lambda) throw (Exception::DivisionByZero) |
T | operator* (const TVector2 &vector) const |
Geometric properties | |
T | getDistance (const TVector2 &vector) const |
T | getSquareDistance (const TVector2 &vector) const |
Predicates | |
bool | operator== (const TVector2 &vector) const |
bool | operator!= (const TVector2 &vector) const |
bool | isZero () const |
bool | isOrthogonalTo (TVector2 &vector) const |
Debugging and Diagnostics | |
void | dump (std::ostream &s=std::cout, Size depth=0) const |
bool | isValid () const |
Public Attributes | |
Vector components | |
T | x |
T | y |
Assignment | |
| |
void | set (const T &value) |
void | set (const T &vx, const T &vy) |
void | set (const TVector2 &vector) |
TVector2 & | operator= (const TVector2 &v) |
TVector2 & | operator= (const T &value) |
TVector2 & | operator= (const T *ptr) throw (Exception::NullPointer) |
T | getLength () const |
T | getSquareLength () const |
TVector2 & | normalize () throw (Exception::DivisionByZero) |
TVector2 & | negate () |
T & | operator[] (Position position) throw (Exception::IndexOverflow) |
const T & | operator[] (Position position) const throw (Exception::IndexOverflow) |
static const TVector2 & | getZero () |
static const TVector2 & | getUnit () |
Generic Two-Dimensional Vector.
Definition at line 64 of file vector2.h.
BALL::TVector2< T >::TVector2 | ( | ) | [inline] |
BALL::TVector2< T >::TVector2 | ( | const T & | value | ) | [inline, explicit] |
BALL::TVector2< T >::TVector2 | ( | const T & | vx, | |
const T & | vy | |||
) | [inline] |
BALL::TVector2< T >::TVector2 | ( | const TVector2< T > & | vector | ) | [inline] |
BALL_INLINE BALL::TVector2< T >::TVector2 | ( | const T * | ptr | ) | throw (Exception::NullPointer) [inline] |
BALL::TVector2< T >::~TVector2 | ( | ) | [inline, virtual] |
void BALL::TVector2< T >::clear | ( | ) | [inline, virtual] |
Clear method The values are set to 0.
Reimplemented from BALL::Object.
void BALL::TVector2< T >::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [inline] |
BALL_INLINE T BALL::TVector2< T >::getDistance | ( | const TVector2< T > & | vector | ) | const [inline] |
BALL_INLINE T BALL::TVector2< T >::getLength | ( | ) | const [inline] |
BALL_INLINE T BALL::TVector2< T >::getSquareDistance | ( | const TVector2< T > & | vector | ) | const [inline] |
BALL_INLINE T BALL::TVector2< T >::getSquareLength | ( | ) | const [inline] |
BALL_INLINE const TVector2< T > & BALL::TVector2< T >::getUnit | ( | ) | [inline, static] |
BALL_INLINE const TVector2< T > & BALL::TVector2< T >::getZero | ( | ) | [inline, static] |
BALL_INLINE bool BALL::TVector2< T >::isOrthogonalTo | ( | TVector2< T > & | vector | ) | const [inline] |
BALL_INLINE bool BALL::TVector2< T >::isValid | ( | ) | const [inline, virtual] |
BALL_INLINE bool BALL::TVector2< T >::isZero | ( | ) | const [inline] |
Zero predicate. The function Maths::isZero is used to compare the values with zero. Maths::isZero
TVector2< T > & BALL::TVector2< T >::negate | ( | ) | [inline] |
TVector2< T > & BALL::TVector2< T >::normalize | ( | ) | throw (Exception::DivisionByZero) [inline] |
BALL_INLINE bool BALL::TVector2< T >::operator!= | ( | const TVector2< T > & | vector | ) | const [inline] |
Inequality operator. The function Maths::isEqual is used to compare the values. Maths::isEqual
BALL_INLINE T BALL::TVector2< T >::operator* | ( | const TVector2< T > & | vector | ) | const [inline] |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator* | ( | const T & | scalar | ) | const [inline] |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator*= | ( | const T & | scalar | ) | [inline] |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator+ | ( | const TVector2< T > & | b | ) | const [inline] |
BALL_INLINE const TVector2< T > & BALL::TVector2< T >::operator+ | ( | ) | const [inline] |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator+= | ( | const TVector2< T > & | vector | ) | [inline] |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator- | ( | const TVector2< T > & | b | ) | const [inline] |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator- | ( | ) | const [inline] |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator-= | ( | const TVector2< T > & | vector | ) | [inline] |
TVector2< T > BALL::TVector2< T >::operator/ | ( | const T & | lambda | ) | const throw (Exception::DivisionByZero) [inline] |
Fraction of a vector. Return TVector2(x / lambda, y / lambda)
.
lambda | the scalar value to divide by |
Exception::DivisionByZero | if lambda == (T)0 |
TVector2< T > & BALL::TVector2< T >::operator/= | ( | const T & | lambda | ) | throw (Exception::DivisionByZero) [inline] |
Divide a vector by a scalar.
lambda | the scalar value to divide by |
Exception::DivisionByZero | if lambda == (T)0 |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator= | ( | const T * | ptr | ) | throw (Exception::NullPointer) [inline] |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator= | ( | const T & | value | ) | [inline] |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator= | ( | const TVector2< T > & | v | ) | [inline] |
BALL_INLINE bool BALL::TVector2< T >::operator== | ( | const TVector2< T > & | vector | ) | const [inline] |
Equality operator. The function Maths::isEqual is used to compare the values. Maths::isEqual
BALL_INLINE const T & BALL::TVector2< T >::operator[] | ( | Position | position | ) | const throw (Exception::IndexOverflow) [inline] |
Constant array-like access to the components.
Exception::IndexOverflow | if index > 1 |
BALL_INLINE T & BALL::TVector2< T >::operator[] | ( | Position | position | ) | throw (Exception::IndexOverflow) [inline] |
Mutable array-like access to the components.
Exception::IndexOverflow | if index > 1 |
void BALL::TVector2< T >::persistentRead | ( | PersistenceManager & | pm | ) | throw (Exception::GeneralException) [inline, virtual] |
Persistent reading. Reads a TVector2 object from a persistent stream.
pm | the persistence manager |
Reimplemented from BALL::PersistentObject.
void BALL::TVector2< T >::persistentWrite | ( | PersistenceManager & | pm, | |
const char * | name = 0 | |||
) | const throw (Exception::GeneralException) [inline, virtual] |
Persistent writing. Writes a TVector2 object to a persistent stream.
pm | the persistence manager |
Reimplemented from BALL::PersistentObject.
BALL_INLINE void BALL::TVector2< T >::set | ( | const TVector2< T > & | vector | ) | [inline] |
BALL_INLINE void BALL::TVector2< T >::set | ( | const T & | vx, | |
const T & | vy | |||
) | [inline] |
BALL_INLINE void BALL::TVector2< T >::set | ( | const T & | value | ) | [inline] |
T BALL::TVector2< T >::x |
T BALL::TVector2< T >::y |