|
Classes |
|
| class | BALL::TVector4< T > |
| Generic Four-Dimensional Vector.
More... |
|
Typedefs |
|
| typedef TVector4< float > | BALL::Vector4 |
| Default four-dimensional vector
type. |
|
Functions |
|
| template<typename T > | |
| TVector4< T > | BALL::operator* (const T &scalar, const TVector4< T > &v) |
| Multiplication operator for a scalar
and a vector. |
|
| template<typename T > | |
| TVector4< T > | BALL::operator* (const TVector4< T > &v, const T &scalar) |
| Multiplication operator for a vector
and a scalar. |
|
Attributes |
|
| All vector components are public members
for convenience. |
|
| T | BALL::TVector4::x |
| x component of the vector |
|
| T | BALL::TVector4::y |
| y component of the vector |
|
| T | BALL::TVector4::z |
| z component of the vector |
|
| T | BALL::TVector4::h |
| height component of the
vector |
|
Global binary operators for three-dimensional vectors. |
|
| template<typename T > | |
| TVector4< T > | BALL::operator+ (const TVector4< T > &a, const TVector4< T > &b) |
| Addition operator for two
vectors. |
|
| template<typename T > | |
| TVector4< T > | BALL::operator- (const TVector4< T > &a, const TVector4< T > &b) |
| Subtraction operator for two
vectors. |
|
| template<typename T > | |
| std::istream & | BALL::operator>> (std::istream &s, TVector4< T > &v) |
| Input operator Reads four values of
type T from an input stream and assigns them to the
components x, y, z and h of the vector. |
|
| template<typename T > | |
| std::ostream & | BALL::operator<< (std::ostream &s, const TVector4< T > &v) |
| Output Operator. |
|
Constructors and Destructors |
|
| BALL::TVector4::TVector4 () | |
| Default constructor. |
|
| BALL::TVector4::TVector4 (const T *ptr) throw (Exception::NullPointer) | |
| Array constructor. |
|
| BALL::TVector4::TVector4 (const T &value) | |
| Scalar constructor. |
|
| BALL::TVector4::TVector4 (const T &x, const T &y, const T &z, const T &h=(T) 1) | |
| Detailed constructor. |
|
| BALL::TVector4::TVector4 (const TVector4 &vector) | |
| Copy constructor. |
|
| virtual | BALL::TVector4::~TVector4 () |
| Destructor. |
|
| virtual void | BALL::TVector4::clear () |
| Clear method The values are set to
0. |
|
Assignment |
|
| void | BALL::TVector4::set (const T *ptr) throw (Exception::NullPointer) |
| Assign from an array. |
|
| void | BALL::TVector4::set (const T &rx, const T &ry, const T &rz, const T &rh=(T) 1) |
| Assign the vector components.
|
|
| void | BALL::TVector4::set (const TVector4 &vector) |
| Assign from another TVector4. |
|
| TVector4 & | BALL::TVector4::operator= (const T *ptr) throw (Exception::NullPointer) |
| Array assignment operator. |
|
| TVector4 & | BALL::TVector4::operator= (const TVector4 &vector) |
| Assignment operator. |
|
| TVector4 & | BALL::TVector4::operator= (T value) |
| Assignment operator. |
|
| void | BALL::TVector4::get (T *ptr) const throw (Exception::NullPointer) |
| Assign to an array. |
|
| void | BALL::TVector4::get (T &rx, T &ry, T &rz, T &rh) const |
Assign to four variables of type
T. |
|
| void | BALL::TVector4::get (TVector4 &vector) const |
| Assign to another Vector4. |
|
| void | BALL::TVector4::swap (TVector4 &vector) |
| Swap the contents of two vectors.
|
|
Accessors |
|
| T | BALL::TVector4::getLength () const |
| Return the length of the vector.
|
|
| T | BALL::TVector4::getSquareLength () const |
| Return the squared length of the
vector. |
|
| TVector4 & | BALL::TVector4::normalize () throw (Exception::DivisionByZero) |
| Normalize the vector. |
|
| static const TVector4 & | BALL::TVector4::getZero () |
| Return a vector with all components
0. |
|
| static const TVector4 & | BALL::TVector4::getUnit () |
| Return a vector with all components
1. |
|
| void | BALL::TVector4::set (const T &value=(T) 1) |
| Assign one value to all vector
components. |
|
| T & | BALL::TVector4::operator[] (Position position) throw (Exception::IndexOverflow) |
| Mutable array-like access to the
components. |
|
| const T & | BALL::TVector4::operator[] (Position position) const throw (Exception::IndexOverflow) |
| Constant
array-like access to the components. |
|
Arithmetic operators |
|
| TVector4 | BALL::TVector4::operator+ () const |
| Positive sign. |
|
| TVector4 | BALL::TVector4::operator- () const |
| Negative sign. |
|
| TVector4 & | BALL::TVector4::operator+= (const TVector4 &vector) |
| Add a vector to this vector.
|
|
| TVector4 & | BALL::TVector4::operator-= (const TVector4 &vector) |
| Subtract a vector from this vector.
|
|
| TVector4 | BALL::TVector4::operator* (const T &scalar) |
| Scalar product. |
|
| TVector4 & | BALL::TVector4::operator*= (const T &scalar) |
| Multiply by a scalar. |
|
| TVector4 | BALL::TVector4::operator/ (const T &scalar) throw (Exception::DivisionByZero) |
| Fraction of a vector. |
|
| TVector4 & | BALL::TVector4::operator/= (const T &scalar) throw (Exception::DivisionByZero) |
| Divide a vector by a scalar.
|
|
| T | BALL::TVector4::operator* (const TVector4 &vector) const |
| Dot product. |
|
| T | BALL::TVector4::getDistance (const TVector4 &vector) const |
| Return the distance to another
vector. |
|
| T | BALL::TVector4::getSquareDistance (const TVector4 &vector) const |
| Return the squared distance to
another vector. |
|
Predicates |
|
| bool | BALL::TVector4::operator== (const TVector4 &vector) const |
| Equality operator. |
|
| bool | BALL::TVector4::operator!= (const TVector4 &vector) const |
| Inequality operator. |
|
| bool | BALL::TVector4::isOrthogonalTo (const TVector4 &vector) const |
| Orthogonality predicate. |
|
Debugging and Diagnostics |
|
| bool | BALL::TVector4::isValid () const |
| Test whether instance is valid.
|
|
| void | BALL::TVector4::dump (std::ostream &s=std::cout, Size depth=0) const |
| Internal state dump. |
|
| void BALL::TVector4< T >::dump | ( | std::ostream & | s =
std::cout, |
|
| Size | depth =
0 |
|||
| ) | const [inherited] |
Internal state dump.
Dump the current internal state of {*this} to the output ostream s with dumping depth depth .
| s | - output stream where to output the internal state of {*this} | |
| depth | - the dumping depth |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| void BALL::TVector4< T >::get | ( | TVector4< T > & | vector | ) | const [inherited] |
Assign to another Vector4.
Assigns the vector components to another vector.
| vector | the vector to be assigned to |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| void BALL::TVector4< T >::get | ( | T & | rx, | |
| T & | ry, | |||
| T & | rz, | |||
| T & | rh | |||
| ) | const [inherited] |
Assign to four variables of type T.
| rx | the x component | |
| ry | the y component | |
| rz | the z component | |
| rh | the h component |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| void BALL::TVector4< T >::get | ( | T * | ptr | ) | const throw (Exception::NullPointer)
[inherited] |
Assign to an array.
Sets the first four array elements pointed of array
ptr to the values of the four vector
components.
| ptr | the array |
| NullPointer | if ptr == 0 |
| T BALL::TVector4< T >::getDistance | ( | const TVector4< T > & | vector | ) | const [inherited] |
Return the distance to another vector.
| vector | the reference vector |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| T BALL::TVector4< T >::getLength | ( | ) | const [inherited] |
Return the length of the vector.
The length of the vector is calculated as
.
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| T BALL::TVector4< T >::getSquareDistance | ( | const TVector4< T > & | vector | ) | const [inherited] |
Return the squared distance to another vector.
This method avoids the square root needed in getDistance, so this method should be preferred if possible.
| vector | the reference vector |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| T BALL::TVector4< T >::getSquareLength | ( | ) | const [inherited] |
Return the squared length of the vector.
This method avoids the square root needed in getLength, so this method should be preferred if possible.

References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| bool BALL::TVector4< T >::isValid | ( | ) | const [inherited] |
Test whether instance is valid.
Always returns true
| TVector4< T > & BALL::TVector4< T >::normalize | ( | ) | throw (Exception::DivisionByZero)
[inherited] |
Normalize the vector.
The vector is scaled with its length:
.
| DivisionByZero | if the length of the vector is 0 |
References BALL::TVector4< T >::h, BALL::Maths::isZero(), BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| bool BALL::TVector4< T >::operator!= | ( | const TVector4< T > & | vector | ) | const [inherited] |
Inequality operator.
The function Maths::isEqual is used to compare the values. Maths::isEqual
References BALL::TVector4< T >::h, BALL::Maths::isNotEqual(), BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4<T> BALL::operator* | ( | const TVector4< T > & | v, | |
| const T & | scalar | |||
| ) |
Multiplication operator for a vector and a scalar.
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4<T> BALL::operator* | ( | const T & | scalar, | |
| const TVector4< T > & | v | |||
| ) |
Multiplication operator for a scalar and a vector.
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| T BALL::TVector4< T >::operator* | ( | const TVector4< T > & | vector | ) | const [inherited] |
Dot product.
| vector | the vector to multiply by |
vector.References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > BALL::TVector4< T >::operator* | ( | const T & | scalar | ) | [inherited] |
Scalar product.
Return TVector4(x * scalar, y * scalar, z *
scalar, h * scalar).
| scalar | the scalar to multiply by |
scalarReferences BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > & BALL::TVector4< T >::operator*= | ( | const T & | scalar | ) | [inherited] |
Multiply by a scalar.
Multiply all components of the vector with a
scalar.
| scalar | the scalar to multiply by |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > & BALL::TVector4< T >::operator+= | ( | const TVector4< T > & | vector | ) | [inherited] |
Add a vector to this vector.
| vector | the vector to add |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > BALL::operator- | ( | const TVector4< T > & | a, | |
| const TVector4< T > & | b | |||
| ) |
Subtraction operator for two vectors.
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > & BALL::TVector4< T >::operator-= | ( | const TVector4< T > & | vector | ) | [inherited] |
Subtract a vector from this vector.
| vector | the vector to subtract |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > BALL::TVector4< T >::operator/ | ( | const T & | scalar | ) | throw (Exception::DivisionByZero)
[inherited] |
Fraction of a vector.
Return TVector4(x / scalar,
y / scalar, z / scalar, h / scalar).
| scalar | the scalar to divide by |
| Exception::DivisionByZero | if scalar == (T)0 |
References BALL::Maths::isZero().
| TVector4< T > & BALL::TVector4< T >::operator/= | ( | const T & | scalar | ) | throw (Exception::DivisionByZero)
[inherited] |
Divide a vector by a scalar.
| scalar | the scalar to divide by |
| Exception::DivisionByZero | if scalar == (T)0 |
References BALL::Maths::isZero().
| std::ostream & BALL::operator<< | ( | std::ostream & | s, | |
| const TVector4< T > & | v | |||
| ) |
Output Operator.
Write the four components of the vector to an output stream. The values are enclosed by brackets.
(0.1 2.0 0 1)| TVector4< T > & BALL::TVector4< T >::operator= | ( | T | value | ) | [inherited] |
Assignment operator.
Assign a constant value to all four vector components.
| value | the constant to assign to x, y, z, h |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > & BALL::TVector4< T >::operator= | ( | const TVector4< T > & | vector | ) | [inherited] |
Assignment operator.
Assign the vector components from another vector.
| vector | the vector to assign from |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| TVector4< T > & BALL::TVector4< T >::operator= | ( | const T * | ptr | ) | throw (Exception::NullPointer)
[inherited] |
Array assignment operator.
Assigns the first four elements of an array to the vector components x, y, z and h.
| ptr | the array |
| NullPointer | if ptr == 0 |
| bool BALL::TVector4< T >::operator== | ( | const TVector4< T > & | vector | ) | const [inherited] |
Equality operator.
The function Maths::isEqual is used to compare the values. Maths::isEqual
References BALL::TVector4< T >::h, BALL::Maths::isEqual(), BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| const T & BALL::TVector4< T >::operator[] | ( | Position | position | ) | const throw (Exception::IndexOverflow)
[inherited] |
Constant array-like access to the components.
| Exception::IndexOverflow | if index > 3 |
| T & BALL::TVector4< T >::operator[] | ( | Position | position | ) | throw (Exception::IndexOverflow)
[inherited] |
Mutable array-like access to the components.
| Exception::IndexOverflow | if index > 3 |
| void BALL::TVector4< T >::set | ( | const T & | value =
(T)1 |
) | [inherited] |
Assign one value to all vector components.
| value | the value to be assigned to, default: 1 |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| void BALL::TVector4< T >::set | ( | const TVector4< T > & | vector | ) | [inherited] |
Assign from another TVector4.
| vector | the TVector4 object to assign from |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| void BALL::TVector4< T >::set | ( | const T & | rx, | |
| const T & | ry, | |||
| const T & | rz, | |||
| const T & | rh =
(T)1 |
|||
| ) | [inherited] |
Assign the vector components.
| rx | the new x component | |
| ry | the new y component | |
| rz | the new z component | |
| rh | the new h component, default: 1 |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| void BALL::TVector4< T >::set | ( | const T * | ptr | ) | throw (Exception::NullPointer)
[inherited] |
Assign from an array.
Assign the four components x,
y, z and h from the
first four elements of the array pointed to by
ptr.
| ptr | an array |
| Nullpointer | if ptr == 0 |
| void BALL::TVector4< T >::swap | ( | TVector4< T > & | vector | ) | [inherited] |
Swap the contents of two vectors.
| vector | the vector to swap contents with |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| BALL::TVector4< T >::TVector4 | ( | const TVector4< T > & | vector | ) | [inherited] |
| BALL::TVector4< T >::TVector4 | ( | const T & | x, | |
| const T & | y, | |||
| const T & | z, | |||
| const T & | h =
(T)1 |
|||
| ) | [inherited] |
Detailed constructor.
Create a new TVector4 object from
three or four values of type T.
| x | assigned to x |
|
| y | assigned to y |
|
| z | assigned to z |
|
| h | assigned to h, default: 1 ; |
| BALL::TVector4< T >::TVector4 | ( | const T & | value | ) | [explicit, inherited] |
Scalar constructor.
Create a new vector with all components set to the same
value.
| value | the value of all components |
| BALL::TVector4< T >::TVector4 | ( | const T * | ptr | ) | throw (Exception::NullPointer)
[inherited] |
Array constructor.
This constructor creates a TVector4 object from
the first four elements pointed by ptr.
| ptr | the array to construct from |
| NullPointer | if ptr == 0 |
References BALL::TVector4< T >::h, BALL::TVector4< T >::x, BALL::TVector4< T >::y, and BALL::TVector4< T >::z.
| BALL::TVector4< T >::TVector4 | ( | ) | [inherited] |
Default constructor.
This method creates a new TVector4 object. The
four components are initialized to (T)0.
| BALL::TVector4< T >::~TVector4 | ( | ) | [virtual, inherited] |
Destructor.
Destructs the TVector4 object. As there are no dynamic data structures, nothing happens.
1.5.8