#include <BALL/MATHS/vector3.h>
Public Member Functions | |
Constructors and Destructors | |
TVector3 () | |
TVector3 (const T *ptr) throw (Exception::NullPointer) | |
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 throw (Exception::DivisionByZero) |
TVector3 & | operator/= (const T &lambda) throw (Exception::DivisionByZero) |
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. | |
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 | |
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) throw (Exception::NullPointer) |
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) throw (Exception::NullPointer) |
void | get (T *ptr) const throw (Exception::NullPointer) |
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 () throw (Exception::DivisionByZero) |
TVector3 & | negate () |
T & | operator[] (Position position) throw (Exception::IndexOverflow) |
const T & | operator[] (Position position) const throw (Exception::IndexOverflow) |
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 throw (Exception::DivisionByZero) |
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.
Definition at line 72 of file vector3.h.
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | ) | [inline] |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const T * | ptr | ) | throw (Exception::NullPointer) [inline, explicit] |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const T & | value | ) | [inline, explicit] |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const TVector3< T2 > & | vec | ) | [inline, explicit] |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const T & | vx, | |
const T & | vy, | |||
const T & | vz | |||
) | [inline] |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const TVector3< T > & | vector | ) | [inline] |
BALL_INLINE BALL::TVector3< T >::TVector3 | ( | const T & | r, | |
const TAngle< T > & | phi, | |||
const TAngle< T > & | theta | |||
) | [inline] |
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 | ( | ) | [inline] |
BALL_INLINE void BALL::TVector3< T >::clear | ( | ) | [inline] |
void BALL::TVector3< T >::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [inline] |
BALL_INLINE void BALL::TVector3< T >::get | ( | T & | r, | |
TAngle< T > & | phi, | |||
TAngle< T > & | theta | |||
) | const [inline] |
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 & | x, | |
T & | y, | |||
T & | z | |||
) | const [inline] |
BALL_INLINE void BALL::TVector3< T >::get | ( | T * | ptr | ) | const throw (Exception::NullPointer) [inline] |
TAngle<T> BALL::TVector3< T >::getAngle | ( | const TVector3< T > & | vector | ) | const throw (Exception::DivisionByZero) |
Return the enclosed angle of two vectors.
Exception::DivisionByZero | if the product of the squared lengths of the two vectors equals (T)0 |
TAngle<T> BALL::TVector3< T >::getAngle_ | ( | const T & | a, | |
const T & | b | |||
) | const [inline, private] |
T BALL::TVector3< T >::getDistance | ( | const TVector3< T > & | vector | ) | const |
Return the distance to another vector.
BALL_INLINE T BALL::TVector3< T >::getLength | ( | ) | const [inline] |
TVector3 BALL::TVector3< T >::getOrthogonalProjection | ( | const TVector3< T > & | direction | ) | const |
Return the orthogonal projection of this vector onto another.
direction | the vector to project onto |
static TVector3 BALL::TVector3< T >::getPerpendicularNormalization | ( | const TVector3< T > & | a, | |
const TVector3< T > & | b, | |||
const TVector3< T > & | c | |||
) | [static] |
Return the perpendicular normalization of the vector
a | 1st vector | |
b | 2nd vector | |
c | 3rd vector |
T BALL::TVector3< T >::getSquareDistance | ( | const TVector3< T > & | vector | ) | const |
Return the squared distance to another vector.
BALL_INLINE T BALL::TVector3< T >::getSquareLength | ( | ) | const [inline] |
BALL_INLINE T BALL::TVector3< T >::getTripleProduct | ( | const TVector3< T > & | a, | |
const TVector3< T > & | b, | |||
const TVector3< T > & | c | |||
) | [inline, static] |
BALL_INLINE const TVector3< T > & BALL::TVector3< T >::getUnit | ( | ) | [inline, static] |
BALL_INLINE const TVector3< T > & BALL::TVector3< T >::getZero | ( | ) | [inline, static] |
bool BALL::TVector3< T >::isOrthogonalTo | ( | const TVector3< T > & | vector | ) | const |
Orthogonality predicate.
BALL_INLINE bool BALL::TVector3< T >::isValid | ( | ) | const [inline] |
BALL_INLINE bool BALL::TVector3< T >::isZero | ( | ) | const [inline] |
Zero predicate. The function Maths::isZero is used to compare the values with zero. Maths::isZero
BALL_INLINE TVector3< T > & BALL::TVector3< T >::negate | ( | ) | [inline] |
TVector3< T > & BALL::TVector3< T >::normalize | ( | ) | throw (Exception::DivisionByZero) [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 BALL::TVector3< T >::operator% | ( | const TVector3< T > & | vector | ) | const |
Cross product. Return the cross product of this vector and vector
.
TVector3& BALL::TVector3< T >::operator%= | ( | const TVector3< T > & | vector | ) |
Assign to the cross product. Assign the vector to its cross product with another vector.
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 | ) | const [inline] |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator*= | ( | const T & | scalar | ) | [inline] |
TVector3 BALL::TVector3< T >::operator+ | ( | const TVector3< T > & | b | ) | const |
BALL_INLINE const TVector3< T > & BALL::TVector3< T >::operator+ | ( | ) | const [inline] |
TVector3& BALL::TVector3< T >::operator+= | ( | const TVector3< T > & | vector | ) |
Add a vector to this vector. Add the components of vector
to this vector.
vector | the vector to add |
TVector3 BALL::TVector3< T >::operator- | ( | const TVector3< T > & | b | ) | const |
BALL_INLINE TVector3< T > BALL::TVector3< T >::operator- | ( | ) | const [inline] |
TVector3& BALL::TVector3< T >::operator-= | ( | const TVector3< T > & | vector | ) |
Subtract a vector from this vector.
vector | the vector to subtract |
TVector3< T > BALL::TVector3< T >::operator/ | ( | const T & | lambda | ) | const throw (Exception::DivisionByZero) [inline] |
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 | ) | throw (Exception::DivisionByZero) [inline] |
Divide a vector by a scalar.
lambda | the scalar value to divide by |
Exception::DivisionByZero | if lambda == (T)0 |
bool BALL::TVector3< T >::operator< | ( | const TVector3< T > & | vector | ) | const |
Needed for MSVC.
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator= | ( | const T * | ptr | ) | throw (Exception::NullPointer) [inline] |
BALL_INLINE TVector3< T > & BALL::TVector3< T >::operator= | ( | T | value | ) | [inline] |
TVector3& BALL::TVector3< T >::operator= | ( | const TVector3< T > & | v | ) |
Assignment operator. Assign the vector components from another vector.
v | the vector to assign from |
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 const T & BALL::TVector3< T >::operator[] | ( | Position | position | ) | const throw (Exception::IndexOverflow) [inline] |
Constant array-like access to the components.
Exception::IndexOverflow | if index > 2 |
BALL_INLINE T & BALL::TVector3< T >::operator[] | ( | Position | position | ) | throw (Exception::IndexOverflow) [inline] |
Mutable array-like access to the components.
Exception::IndexOverflow | if index > 2 |
bool BALL::TVector3< T >::read | ( | PersistenceManager & | pm | ) | [inline] |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T & | r, | |
const TAngle< T > & | phi, | |||
const TAngle< T > & | theta | |||
) | [inline] |
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 |
void BALL::TVector3< T >::set | ( | const TVector3< T > & | vector | ) |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T & | vx, | |
const T & | vy, | |||
const T & | vz | |||
) | [inline] |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T & | value | ) | [inline] |
BALL_INLINE void BALL::TVector3< T >::set | ( | const T * | ptr | ) | throw (Exception::NullPointer) [inline] |
void BALL::TVector3< T >::swap | ( | TVector3< T > & | vector | ) |
Swap the contents of two vectors.
vector | the vector to swap contents with |
void BALL::TVector3< T >::write | ( | PersistenceManager & | pm | ) | const [inline] |
T BALL::TVector3< T >::x |
T BALL::TVector3< T >::y |
T BALL::TVector3< T >::z |