BALL
1.4.2
|
#include <BALL/MATHS/vector3.h>
Public Member Functions | |
template<typename T2 > | |
BALL_INLINE | TVector3 (const TVector3< T2 > &vec) |
Constructors and Destructors | |
TVector3 () | |
TVector3 (const T *ptr) | |
TVector3 (const T &value) | |
template<typename T2 > | |
TVector3 (const TVector3< T2 > &vec) | |
TVector3 (const T &vx, const T &vy, const T &vz) | |
TVector3 (const TVector3 &vector) | |
TVector3 (const T &r, const TAngle< T > &phi, const TAngle< T > &theta) | |
~TVector3 () | |
void | clear () |
Arithmetic operators | |
const TVector3 & | operator+ () const |
TVector3 | operator- () const |
TVector3 | operator+ (const TVector3 &b) const |
TVector3 | operator- (const TVector3 &b) const |
TVector3 & | operator+= (const TVector3 &vector) |
TVector3 & | operator-= (const TVector3 &vector) |
TVector3 | operator* (const T &scalar) const |
TVector3 & | operator*= (const T &scalar) |
TVector3 | operator/ (const T &lambda) const |
TVector3 & | operator/= (const T &lambda) |
T | operator* (const TVector3 &vector) const |
TVector3 | operator% (const TVector3 &vector) const |
TVector3 & | operator%= (const TVector3 &vector) |
Predicates | |
bool | operator== (const TVector3 &vector) const |
bool | operator!= (const TVector3 &vector) const |
bool | operator< (const TVector3 &vector) const |
Needed for MSVC. More... | |
bool | isZero () const |
bool | isOrthogonalTo (const TVector3 &vector) const |
Storable Interface | |
void | write (PersistenceManager &pm) const |
bool | read (PersistenceManager &pm) |
Debugging and Diagnostics | |
void | dump (std::ostream &s=std::cout, Size depth=0) const |
bool | isValid () const |
Public Attributes | |
Vector components | |
For easier access, the three components of the vector are public members. | |
T | x |
T | y |
T | z |
Private Member Functions | |
TAngle< T > | getAngle_ (const T &a, const T &b) const |
Assignment | |
void | set (const T *ptr) |
void | set (const T &value) |
void | set (const T &vx, const T &vy, const T &vz) |
void | set (const TVector3 &vector) |
void | set (const T &r, const TAngle< T > &phi, const TAngle< T > &theta) |
TVector3 & | operator= (const TVector3 &v) |
TVector3 & | operator= (T value) |
TVector3 & | operator= (const T *ptr) |
void | get (T *ptr) const |
void | get (T &x, T &y, T &z) const |
void | get (TVector3 &vector) const |
void | get (T &r, TAngle< T > &phi, TAngle< T > &theta) const |
void | swap (TVector3 &vector) |
T | getLength () const |
T | getSquareLength () const |
TVector3 & | normalize () |
TVector3 & | negate () |
T & | operator[] (Position position) |
const T & | operator[] (Position position) const |
static const TVector3 & | getZero () |
static const TVector3 & | getUnit () |
Geometric properties | |
T | getDistance (const TVector3 &vector) const |
T | getSquareDistance (const TVector3 &vector) const |
TAngle< T > | getAngle (const TVector3 &vector) const |
TVector3 | getOrthogonalProjection (const TVector3 &direction) const |
static TVector3 | getPerpendicularNormalization (const TVector3 &a, const TVector3 &b, const TVector3 &c) |
static T | getTripleProduct (const TVector3< T > &a, const TVector3< T > &b, const TVector3< T > &c) |
Generic Three-Dimensional Vector.
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | ) |
|
explicit |
|
explicit |
|
explicit |
Explicit type conversion constructor between a vector of type T and T2
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const T & | vx, |
const T & | vy, | ||
const T & | vz | ||
) |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const TVector3< T > & | vector | ) |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const T & | r, |
const TAngle< T > & | phi, | ||
const TAngle< T > & | theta | ||
) |
Spherical polar coordinate constructor. Create a TVector3 object and set its coordinates to the point described by the three spherical polar coordinates r
(radius), phi
(azimuth), and theta
(co-latitude).
r | the radius |
phi | the azimuth |
theta | the co-latitude |
BALL_INLINE BALL::TVector3< T >::~TVector3 | ( | ) |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const TVector3< T2 > & | vec | ) |
BALL_INLINE void BALL::TVector3< T >::clear | ( | ) |
void BALL::TVector3< T >::dump | ( | std::ostream & | s = std::cout , |
Size | depth = 0 |
||
) | const |
BALL_INLINE void BALL::TVector3< T >::get | ( | T * | ptr | ) | const |
BALL_INLINE void BALL::TVector3< T >::get | ( | T & | x, |
T & | y, | ||
T & | z | ||
) | const |
void BALL::TVector3< T >::get | ( | TVector3< T > & | vector | ) | const |
Assign to another Vector3. Assigns the vector components to another vector.
vector | the vector to be assigned to |
BALL_INLINE void BALL::TVector3< T >::get | ( | T & | r, |
TAngle< T > & | phi, | ||
TAngle< T > & | theta | ||
) | const |
BALL_INLINE TAngle< T > BALL::TVector3< T >::getAngle | ( | const TVector3< T > & | vector | ) | const |
Return the enclosed angle of two vectors.
Exception::DivisionByZero | if the product of the squared lengths of the two vectors equals (T)0 |
|
inlineprivate |
BALL_INLINE T BALL::TVector3< T >::getDistance | ( | const TVector3< T > & | vector | ) | const |
BALL_INLINE T BALL::TVector3< T >::getLength | ( | ) | const |
BALL_INLINE TVector3< T > BALL::TVector3< T >::getOrthogonalProjection | ( | const TVector3< T > & | direction | ) | const |
|
static |
BALL_INLINE T BALL::TVector3< T >::getSquareDistance | ( | const TVector3< T > & | vector | ) | const |
BALL_INLINE T BALL::TVector3< T >::getSquareLength | ( | ) | const |
|
static |
|
static |
|
static |
BALL_INLINE bool BALL::TVector3< T >::isOrthogonalTo | ( | const TVector3< T > & | vector | ) | const |
BALL_INLINE bool BALL::TVector3< T >::isValid | ( | ) | const |
BALL_INLINE bool BALL::TVector3< T >::isZero | ( | ) | const |
Zero predicate. The function Maths::isZero is used to compare the values with zero. Maths::isZero
BALL_INLINE TVector3< T > & BALL::TVector3< T >::negate | ( | ) |
TVector3< T > & BALL::TVector3< T >::normalize | ( | ) |
BALL_INLINE bool BALL::TVector3< T >::operator!= | ( | const TVector3< T > & | vector | ) | const |
Inequality operator. The function Maths::isEqual is used to compare the values. Maths::isEqual
TVector3< T > BALL::TVector3< T >::operator% | ( | const TVector3< T > & | vector | ) | const |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator%= | ( | const TVector3< T > & | vector | ) |
BALL_INLINE TVector3< T > BALL::TVector3< T >::operator* | ( | const T & | scalar | ) | const |
T BALL::TVector3< T >::operator* | ( | const TVector3< T > & | vector | ) | const |
Dot product. Return the dot product of this vector and vector
.
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator*= | ( | const T & | scalar | ) |
BALL_INLINE const TVector3< T > & BALL::TVector3< T >::operator+ | ( | ) | const |
TVector3 BALL::TVector3< T >::operator+ | ( | const TVector3< T > & | b | ) | const |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator+= | ( | const TVector3< T > & | vector | ) |
BALL_INLINE TVector3< T > BALL::TVector3< T >::operator- | ( | ) | const |
TVector3 BALL::TVector3< T >::operator- | ( | const TVector3< T > & | b | ) | const |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator-= | ( | const TVector3< T > & | vector | ) |
TVector3< T > BALL::TVector3< T >::operator/ | ( | const T & | lambda | ) | const |
Fraction of a vector. Return TVector3(x / lambda, y / lambda, z / lambda)
.
lambda | the scalar value to divide by |
Exception::DivisionByZero | if lambda == (T)0 |
TVector3< T > & BALL::TVector3< 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 bool BALL::TVector3< T >::operator< | ( | const TVector3< T > & | vector | ) | const |
TVector3& BALL::TVector3< T >::operator= | ( | const TVector3< T > & | v | ) |
Assignment operator. Assign the vector components from another vector.
v | the vector to assign from |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator= | ( | T | value | ) |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator= | ( | const T * | ptr | ) |
BALL_INLINE bool BALL::TVector3< T >::operator== | ( | const TVector3< T > & | vector | ) | const |
Equality operator. The function Maths::isEqual is used to compare the values. Maths::isEqual
BALL_INLINE T & BALL::TVector3< T >::operator[] | ( | Position | position | ) |
Mutable array-like access to the components.
Exception::IndexOverflow | if index > 2 |
BALL_INLINE const T & BALL::TVector3< T >::operator[] | ( | Position | position | ) | const |
Constant array-like access to the components.
Exception::IndexOverflow | if index > 2 |
bool BALL::TVector3< T >::read | ( | PersistenceManager & | pm | ) |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T * | ptr | ) |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T & | value | ) |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T & | vx, |
const T & | vy, | ||
const T & | vz | ||
) |
void BALL::TVector3< T >::set | ( | const TVector3< T > & | vector | ) |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T & | r, |
const TAngle< T > & | phi, | ||
const TAngle< T > & | theta | ||
) |
Assign from spherical polar coordinates. The radius describes the distance of the point from the origin.
phi
ranges from 0 to , theta
ranges from 0 (north pole, positive z-axis) to (south pole, negative z-axis).
r | the radius |
phi | the azimuth |
theta | the co-latitude |
BALL_INLINE void BALL::TVector3< T >::swap | ( | TVector3< T > & | vector | ) |
void BALL::TVector3< T >::write | ( | PersistenceManager & | pm | ) | const |
T BALL::TVector3< T >::x |
T BALL::TVector3< T >::y |
T BALL::TVector3< T >::z |