|
ML Reference
|
#include <mlFloatingPointVector.h>
Public Types | |
| enum | { Size = size } |
| typedef T | ComponentType |
| A typedef to 'export' the type of components. | |
Public Member Functions | |
Constructors and assignment operators. | |
| FloatingPointVector (T value=T(0)) | |
| FloatingPointVector< T, size, DataContainer > & | operator= (T value) |
| Assignment of scalar value to all components. | |
Comparison. | |
| bool | operator== (const FloatingPointVector< T, size, DataContainer > &buffer) const |
| Returns whether *this and buffer are component-wise equal. | |
| bool | operator!= (const FloatingPointVector< T, size, DataContainer > &buffer) const |
| Returns whether any components of *this and buffer are not equal. | |
| bool | operator< (const FloatingPointVector< T, size, DataContainer > &buffer) const |
Value access and indexing operators. | |
| const T & | operator[] (const size_t i) const |
| T & | operator[] (const size_t i) |
Other operations. | |
| size_t | getSize () const |
| Returns the number of elements of value buffer. | |
| T | norm2 () const |
| T | norm2 (const FloatingPointVector< T, size, DataContainer > &weight) const |
| T | dot (const FloatingPointVector< T, size, DataContainer > &buffer) const |
| T | normalize () |
| T | length () const |
| Returns the length of the vector, i.e., norm2(). | |
| T | distance (const FloatingPointVector< T, size, DataContainer > &buffer) const |
| Returns the distance of this vector to a given one. | |
| T | distanceSquared (const FloatingPointVector< T, size, DataContainer > &buffer) const |
| Returns the squared distance of this vector to a given one. | |
| T | lengthSquared () const |
| Returns the squared length of the vector. | |
| T | compSum () const |
| Returns the sum of all components. | |
| T | compMul () const |
| Returns the product of all vector components. | |
| T | compMaxAbs () const |
| Returns the maximum of absolute component values. | |
| void | compMin (FloatingPointVector< T, size, DataContainer > buffer) |
| Sets the component-wise minimum of *this and buffer in *this. | |
| void | compMax (FloatingPointVector< T, size, DataContainer > buffer) |
| Sets the component-wise maximum of *this and buffer in *this. | |
| void | compAbs () |
| Kills negative signs from all components. | |
| void | compDiv (const FloatingPointVector< T, size, DataContainer > &d) |
| void | compSqr () |
| Calculates and sets the square of all components. | |
| void | compSqrt () |
| void | clampMin (const FloatingPointVector< T, size, DataContainer > &lower) |
| void | clampMax (const FloatingPointVector< T, size, DataContainer > &upper) |
| void | clamp (const FloatingPointVector< T, size, DataContainer > &lower, const FloatingPointVector< T, size, DataContainer > &upper) |
| void | compRound () |
| Rounds all components of this vector using floor(component + 0.5). | |
| void | compFloor () |
| Rounds all components of this vector using floor(component). | |
| void | compCeil () |
| Rounds all components of this vector to integer using ceil(component). | |
| FloatingPointVector< T, 3, DataContainer > | cross (const FloatingPointVector< T, 3, DataContainer > &b) const |
| Returns the cross product for elements, i.e., the returned vector is orthogonal to *this and b. | |
| void | apply (ML_LA_FROM_DOUBLE_TO_DOUBLE f) |
Applies the function f to each component starting from index 0 to index size-1. | |
| std::ostream & | writeOut (std::ostream &os) const |
| std::istream & | readIn (std::istream &is) |
Reads all components from istream is starting starting from index 0 to size-1. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Standalone functions for FloatingPointVector. | |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > & | operator+= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &buffer) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > & | operator-= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &buffer) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > & | operator*= (FloatingPointVector< T, size, DataContainer > &op1, MLdouble value) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > & | operator*= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &op2) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > & | operator/= (FloatingPointVector< T, size, DataContainer > &op1, MLdouble value) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > & | operator/= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &op2) |
| template<class T, size_t size, class DataContainer> | |
| bool | operator! (const FloatingPointVector< T, size, DataContainer > &a) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator+ (FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator- (FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator+ (const FloatingPointVector< T, size, DataContainer > &buffer) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator- (const FloatingPointVector< T, size, DataContainer > &buffer) |
| template<class T, size_t size, class DataContainer> | |
| T | operator* (const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator* (FloatingPointVector< T, size, DataContainer > lhs, MLdouble rhs) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator* (MLdouble lhs, FloatingPointVector< T, size, DataContainer > rhs) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | operator/ (FloatingPointVector< T, size, DataContainer > lhs, MLdouble rhs) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | compMin (FloatingPointVector< T, size, DataContainer > buffer1, const FloatingPointVector< T, size, DataContainer > &buffer2) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | compMax (FloatingPointVector< T, size, DataContainer > buffer1, const FloatingPointVector< T, size, DataContainer > &buffer2) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | compAbs (FloatingPointVector< T, size, DataContainer > vec) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | compSqr (FloatingPointVector< T, size, DataContainer > vec) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | compSqrt (FloatingPointVector< T, size, DataContainer > vec) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | compDiv (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &d) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | clampMin (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &m) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | clampMax (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &m) |
| template<class T, size_t size, class DataContainer> | |
| FloatingPointVector< T, size, DataContainer > | clamp (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &lower, const FloatingPointVector< T, size, DataContainer > &upper) |
| template<class T, size_t size, class DataContainer> | |
| T | compMul (const FloatingPointVector< T, size, DataContainer > &vec) |
Additional Inherited Members | |
| Protected Attributes inherited from ml::FloatingPointVectorDataContainerBase< DT, size > | |
| DT | _buffer [size] |
Template class for vector arithmetic with floating point datatypes. Notes:
Definition at line 62 of file mlFloatingPointVector.h.
| typedef T ml::FloatingPointVector< T, size, DataContainer >::ComponentType |
A typedef to 'export' the type of components.
Definition at line 68 of file mlFloatingPointVector.h.
| anonymous enum |
This enum grants access to the size during compile time, e.g., it can be used as a template argument.
| Enumerator | |
|---|---|
| Size | |
Definition at line 72 of file mlFloatingPointVector.h.
|
inlineexplicit |
Default and value constructor. Default is the initialization of all components with value whose default is 0.
Definition at line 586 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and FloatingPointVector().
Referenced by clamp(), clampMax(), clampMin(), compDiv(), compMax(), compMin(), dot(), FloatingPointVector(), norm2(), operator!=(), operator<(), operator=(), operator==(), ml::Tvec3< MLfloat >::Tvec3(), ml::Tvec32< MLfloat >::Tvec32(), and ml::Tvec32< MLfloat >::Tvec32().
|
inline |
Applies the function f to each component starting from index 0 to index size-1.
Definition at line 953 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and apply().
Referenced by apply().
|
inline |
Calculates and sets all components of *this so that they are between minimum lower and maximum upper. This is done by applying clampMin(lower) first and then clampMax(upper). Note that the components can become smaller than lower if a component in upper is smaller than their corresponding one in in lower.
Definition at line 912 of file mlFloatingPointVector.h.
References clamp(), clampMax(), clampMin(), and FloatingPointVector().
Referenced by clamp().
|
inline |
Calculates and sets all components clamped to upper, i.e., if any component is greater than the corresponding one in upper, then it is set to the one from upper.
Definition at line 899 of file mlFloatingPointVector.h.
References clampMax(), compMin(), and FloatingPointVector().
Referenced by clamp(), ml::FloatingPointVector< DT, 10 >::clamp(), clampMax(), and ml::FloatingPointVector< DT, 10 >::clampMax().
|
inline |
Calculates and sets all components clamped to lower, i.e., if any component is smaller than the corresponding one in lower, then it is set to the one from lower.
Definition at line 889 of file mlFloatingPointVector.h.
References clampMin(), compMax(), and FloatingPointVector().
Referenced by clamp(), ml::FloatingPointVector< DT, 10 >::clamp(), clampMin(), and ml::FloatingPointVector< DT, 10 >::clampMin().
|
inline |
Kills negative signs from all components.
Definition at line 844 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, compAbs(), and MLAbs().
Referenced by compAbs(), and ml::FloatingPointVector< DT, 10 >::compAbs().
|
inline |
Rounds all components of this vector to integer using ceil(component).
Definition at line 944 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and compCeil().
Referenced by compCeil().
|
inline |
Divides each vector component by the corresponding one of d. Divisions by zero are not handled; the caller must avoid them.
Definition at line 854 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, compDiv(), and FloatingPointVector().
Referenced by compDiv(), and ml::FloatingPointVector< DT, 10 >::compDiv().
|
inline |
Rounds all components of this vector using floor(component).
Definition at line 935 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and compFloor().
Referenced by compFloor().
|
inline |
Sets the component-wise maximum of *this and buffer in *this.
Definition at line 833 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, compMax(), and FloatingPointVector().
Referenced by clampMin(), compMax(), and ml::FloatingPointVector< DT, 10 >::compMax().
|
inline |
Returns the maximum of absolute component values.
Definition at line 809 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, compMaxAbs(), and MLAbs().
Referenced by compMaxAbs().
|
inline |
Sets the component-wise minimum of *this and buffer in *this.
Definition at line 822 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, compMin(), and FloatingPointVector().
Referenced by clampMax(), compMin(), and ml::FloatingPointVector< DT, 10 >::compMin().
|
inline |
Returns the product of all vector components.
Definition at line 798 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and compMul().
Referenced by compMul(), and ml::FloatingPointVector< DT, 10 >::compMul().
|
inline |
Rounds all components of this vector using floor(component + 0.5).
Definition at line 926 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and compRound().
Referenced by compRound().
|
inline |
Calculates and sets the square of all components.
Definition at line 863 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and compSqr().
Referenced by compSqr(), and ml::FloatingPointVector< DT, 10 >::compSqr().
|
inline |
Calculates and sets square root of all components. Negative values have to be avoided by caller.
Definition at line 873 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, compSqrt(), and sqrt().
Referenced by compSqrt(), and ml::FloatingPointVector< DT, 10 >::compSqrt().
|
inline |
Returns the sum of all components.
Definition at line 787 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and compSum().
Referenced by compSum().
|
inline |
Returns the cross product for elements, i.e., the returned vector is orthogonal to *this and b.
Definition at line 220 of file mlFloatingPointVector.h.
Referenced by ml::TQuaternion< MLfloat >::mult().
|
inline |
Returns the distance of this vector to a given one.
Definition at line 151 of file mlFloatingPointVector.h.
|
inline |
Returns the squared distance of this vector to a given one.
Definition at line 157 of file mlFloatingPointVector.h.
|
inline |
Returns the dot product, i.e., sum of all components multiplied with corresponding components of buffer.
Definition at line 741 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, dot(), and FloatingPointVector().
Referenced by dot(), lengthSquared(), ml::TQuaternion< MLfloat >::mult(), and ml::FloatingPointVector< DT, 10 >::operator*().
|
inline |
Returns the number of elements of value buffer.
Definition at line 696 of file mlFloatingPointVector.h.
References getSize().
Referenced by getSize().
|
inline |
Returns the length of the vector, i.e., norm2().
Definition at line 769 of file mlFloatingPointVector.h.
References length(), and norm2().
Referenced by ml::TQuaternion< MLfloat >::cos(), ml::TQuaternion< MLfloat >::cosh(), length(), ml::TQuaternion< MLfloat >::sin(), and ml::TQuaternion< MLfloat >::sinh().
|
inline |
Returns the squared length of the vector.
Definition at line 778 of file mlFloatingPointVector.h.
References dot(), and lengthSquared().
Referenced by lengthSquared().
|
inline |
Returns the Euclidean norm (the vector length), i.e., square root of sum of squares of all components.
Definition at line 706 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, norm2(), and sqrt().
Referenced by length(), norm2(), norm2(), and normalize().
|
inline |
Returns the weighted Euclidean norm, i.e., square root of sum of squares of all components multiplied with corresponding squared component of weight.
Definition at line 722 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, FloatingPointVector(), norm2(), and sqrt().
|
inline |
Normalizes the buffer and returns the Euclidean length of vector before normalization, i.e., norm2. On zero vector length, the vector is left unchanged.
Definition at line 753 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, MLValueIs0WOM(), norm2(), and normalize().
Referenced by ml::Tmat4< DT >::getRotationMatrix(), normalize(), ml::rotation3D(), and ml::Tvec2< MLfloat >::Tvec2().
|
inline |
Returns whether any components of *this and buffer are not equal.
Definition at line 624 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, FloatingPointVector(), MLValuesDifferWOM(), and operator!=().
Referenced by operator!=().
|
inline |
Defines an artificial order for use in sort algorithms (lexicographical order). Starting from the first component (i.e., index 0), all components from *this are compared with the corresponding one in the buffer: If the components of *this are smaller than the corresponding one in buffer, then true is returned. If the comparison is greater, then false is returned. On equality, the components for the next index are compared. If all components are equal, then false is returned.
Definition at line 645 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, FloatingPointVector(), MLValuesDifferWOM(), and operator<().
Referenced by operator<().
|
inline |
Assignment of scalar value to all components.
Definition at line 595 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, FloatingPointVector(), and operator=().
Referenced by operator=().
|
inline |
Returns whether *this and buffer are component-wise equal.
Definition at line 609 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, FloatingPointVector(), MLValuesDifferWOM(), and operator==().
Referenced by operator==().
|
inline |
Indexing operators. The caller must guarantee that is in [0, size-1]. It is legal to consider all elements as a subsequent array in memory for pointer addressing of all elements.
Definition at line 677 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and operator[]().
|
inline |
Constant indexing operators. The caller must guarantee that is in [0, size-1]. It is legal to consider all elements as a subsequent array in memory for pointer addressing of all elements.
Definition at line 666 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and operator[]().
Referenced by operator[](), and operator[]().
|
inline |
Reads all components from istream is starting starting from index 0 to size-1.
Definition at line 973 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, ml::is(), and readIn().
Referenced by readIn().
|
inline |
Writes all components to ostream os starting from index 0 to size-1. Each buffer elements is followed separated by a space " ".
Definition at line 963 of file mlFloatingPointVector.h.
References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and writeOut().
Referenced by writeOut().
|
Returns a new vector with all components from vec clamped to range [lower, upper]. Note that this does not hold if components in lower are greater than their corresponding ones in upper. See FloatingPointVector<T, size, DataContainer>::clamp().
Definition at line 523 of file mlFloatingPointVector.h.
|
Returns a new vector with all components from vec clamped to maximum m. See FloatingPointVector<T, size, DataContainer>::clampMax().
Definition at line 508 of file mlFloatingPointVector.h.
|
Returns a new vector with all components from vec clamped to minimum m. See FloatingPointVector<T, size, DataContainer>::clampMin().
Definition at line 495 of file mlFloatingPointVector.h.
|
Returns a vector with all components from vec without negative sign.
Definition at line 447 of file mlFloatingPointVector.h.
|
Component-wise division of vec / d. Division by zeros are not handled and must be avoided by caller.
Definition at line 482 of file mlFloatingPointVector.h.
|
Component-wise maximum of buffer1 and buffer2.
Definition at line 435 of file mlFloatingPointVector.h.
|
Component-wise minimum of buffer1 and buffer2.
Definition at line 423 of file mlFloatingPointVector.h.
|
Returns the product of all components.
Definition at line 537 of file mlFloatingPointVector.h.
|
Returns a vector with all components from vec squared.
Definition at line 458 of file mlFloatingPointVector.h.
|
Returns a vector with all components from vec square-rooted.
Definition at line 470 of file mlFloatingPointVector.h.
|
Returns whether all components are 0.
Definition at line 326 of file mlFloatingPointVector.h.
|
Dot product, returns a.dot(b).
Definition at line 383 of file mlFloatingPointVector.h.
|
Component-wise multiplication of lhs with rhs.
Definition at line 393 of file mlFloatingPointVector.h.
|
Component-wise multiplication of rhs with lhs.
Definition at line 403 of file mlFloatingPointVector.h.
|
Arithmetic assignment: Component-wise multiplication *this with a vector of the same size.
Definition at line 285 of file mlFloatingPointVector.h.
|
Arithmetic assignment: Component-wise multiplication *this with specialized MLdouble scalar value.
Definition at line 274 of file mlFloatingPointVector.h.
|
Unary plus, for completeness and for those who really want to use that.
Definition at line 360 of file mlFloatingPointVector.h.
|
Return value is the component-wise addition of lhs and rhs.
Definition at line 338 of file mlFloatingPointVector.h.
|
Arithmetic assignment: Component-wise addition.
Definition at line 252 of file mlFloatingPointVector.h.
|
Unary minus, all components of the vector are multiplied with -1.
Definition at line 371 of file mlFloatingPointVector.h.
|
Return value is the component-wise subtraction of rhs from lhs.
Definition at line 349 of file mlFloatingPointVector.h.
|
Arithmetic assignment: Component-wise subtraction of buffer from *this.
Definition at line 263 of file mlFloatingPointVector.h.
|
Component-wise division of lhs by specialized rhs of type MLdouble.
Definition at line 413 of file mlFloatingPointVector.h.
|
Arithmetic assignment: Component-wise division of *this by the values of a vector of the same size. Division by zero is not handled and must be avoided by user.
Definition at line 312 of file mlFloatingPointVector.h.
|
Arithmetic assignment: Component-wise division of *this by scalar value. Division by zero is not handled and must be avoided by user.
Definition at line 297 of file mlFloatingPointVector.h.