BALL
1.4.2
|
#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) | |
virtual | ~TVector2 () |
virtual void | clear () |
Persistence | |
virtual void | persistentWrite (PersistenceManager &pm, const char *name=0) const |
virtual void | persistentRead (PersistenceManager &pm) |
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 |
TVector2 & | operator/= (const T &lambda) |
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 Member Functions inherited from BALL::PersistentObject | |
PersistentObject () | |
virtual | ~PersistentObject () |
PersistenceManager & | operator>> (PersistenceManager &pm) const |
virtual void | finalize () |
Public Member Functions inherited from BALL::Object | |
Object () | |
Default constructor. More... | |
Object (const Object &object) | |
Copy constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
const Object & | operator= (const Object &) |
bool | operator== (const Object &object) const |
bool | operator!= (const Object &object) const |
bool | operator< (const Object &object) const |
bool | operator<= (const Object &object) const |
bool | operator>= (const Object &object) const |
bool | operator> (const Object &object) const |
int | compare (const Object &object) const |
virtual void | dump (::std::ostream &s=std::cout, Size depth=0) const |
Handle | getHandle () const |
Public Member Functions inherited from BALL::AutoDeletable | |
virtual | ~AutoDeletable () |
void * | operator new (size_t size) |
void | operator delete (void *ptr) |
void * | operator new (size_t size, void *ptr) |
void | operator delete (void *ptr, void *) |
bool | isAutoDeletable () const |
void | setAutoDeletable (bool enable) |
Public Attributes | |
Vector components | |
For easier access, the two components of the vector are public members. | |
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) |
T | getLength () const |
T | getSquareLength () const |
TVector2 & | normalize () |
TVector2 & | negate () |
T & | operator[] (Position position) |
const T & | operator[] (Position position) const |
static const TVector2 & | getZero () |
static const TVector2 & | getUnit () |
Additional Inherited Members | |
Static Public Member Functions inherited from BALL::Object | |
static Handle | getNextHandle () |
static Handle | getNewHandle () |
Static Public Member Functions inherited from BALL::AutoDeletable | |
static void | clearLastPtr () |
Protected Member Functions inherited from BALL::AutoDeletable | |
AutoDeletable () | |
AutoDeletable (const AutoDeletable &auto_deletable, bool deep=false) | |
Generic Two-Dimensional Vector.
BALL::TVector2< T >::TVector2 | ( | ) |
|
explicit |
BALL::TVector2< T >::TVector2 | ( | const T & | vx, |
const T & | vy | ||
) |
BALL::TVector2< T >::TVector2 | ( | const TVector2< T > & | vector | ) |
BALL_INLINE BALL::TVector2< T >::TVector2 | ( | const T * | ptr | ) |
|
virtual |
|
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 |
BALL_INLINE T BALL::TVector2< T >::getDistance | ( | const TVector2< T > & | vector | ) | const |
BALL_INLINE T BALL::TVector2< T >::getLength | ( | ) | const |
BALL_INLINE T BALL::TVector2< T >::getSquareDistance | ( | const TVector2< T > & | vector | ) | const |
BALL_INLINE T BALL::TVector2< T >::getSquareLength | ( | ) | const |
|
static |
|
static |
BALL_INLINE bool BALL::TVector2< T >::isOrthogonalTo | ( | TVector2< T > & | vector | ) | const |
|
virtual |
BALL_INLINE bool BALL::TVector2< T >::isZero | ( | ) | const |
Zero predicate. The function Maths::isZero is used to compare the values with zero. Maths::isZero
TVector2< T > & BALL::TVector2< T >::negate | ( | ) |
TVector2< T > & BALL::TVector2< T >::normalize | ( | ) |
BALL_INLINE bool BALL::TVector2< T >::operator!= | ( | const TVector2< T > & | vector | ) | const |
Inequality operator. The function Maths::isEqual is used to compare the values. Maths::isEqual
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator* | ( | const T & | scalar | ) | const |
BALL_INLINE T BALL::TVector2< T >::operator* | ( | const TVector2< T > & | vector | ) | const |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator*= | ( | const T & | scalar | ) |
BALL_INLINE const TVector2< T > & BALL::TVector2< T >::operator+ | ( | ) | const |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator+ | ( | const TVector2< T > & | b | ) | const |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator+= | ( | const TVector2< T > & | vector | ) |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator- | ( | ) | const |
BALL_INLINE TVector2< T > BALL::TVector2< T >::operator- | ( | const TVector2< T > & | b | ) | const |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator-= | ( | const TVector2< T > & | vector | ) |
TVector2< T > BALL::TVector2< T >::operator/ | ( | const T & | lambda | ) | const |
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 | ) |
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 TVector2< T > & | v | ) |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator= | ( | const T & | value | ) |
BALL_INLINE TVector2< T > & BALL::TVector2< T >::operator= | ( | const T * | ptr | ) |
BALL_INLINE bool BALL::TVector2< T >::operator== | ( | const TVector2< T > & | vector | ) | const |
Equality operator. The function Maths::isEqual is used to compare the values. Maths::isEqual
BALL_INLINE T & BALL::TVector2< T >::operator[] | ( | Position | position | ) |
Mutable array-like access to the components.
Exception::IndexOverflow | if index > 1 |
BALL_INLINE const T & BALL::TVector2< T >::operator[] | ( | Position | position | ) | const |
Constant array-like access to the components.
Exception::IndexOverflow | if index > 1 |
|
virtual |
Persistent reading. Reads a TVector2 object from a persistent stream.
pm | the persistence manager |
Exception::GeneralException |
Reimplemented from BALL::PersistentObject.
|
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 T & | value | ) |
BALL_INLINE void BALL::TVector2< T >::set | ( | const T & | vx, |
const T & | vy | ||
) |
BALL_INLINE void BALL::TVector2< T >::set | ( | const TVector2< T > & | vector | ) |
T BALL::TVector2< T >::x |
T BALL::TVector2< T >::y |