#include <geometry.hh>
Collaboration diagram for Vector< n >:

Public Member Functions | |
| Vector () | |
| Default constructor initializes to nothing. | |
| Vector (const double data[n]) | |
| Constructor for initializing to given value. | |
| double | getLength () const |
| Gets the length of the vector. | |
| bool | isNormalized () const |
| Determines if the vector is normalized. | |
| void | normalize () |
| Normalizes this vector, adjusting it to unit length. | |
| void | translateGL () const |
| Translates the current GL context by this vector. | |
| double | operator[] (unsigned int i) const |
| Gets a component of this vector. | |
| const Vector< n > & | operator *= (double d) |
| Multiplies this vector by a scalar. | |
| const Vector< n > & | operator/= (double d) |
| Divides this vector by a scalar. | |
| const Vector< n > & | operator+= (const Vector< n > &v) |
| Adds a vector to this one. | |
| const Vector< n > & | operator-= (const Vector< n > &v) |
| Subtracts a vector from this one. | |
| Vector< n > | operator- () const |
| Returns this vector's inverse. | |
| const Matrix< n+1, 1 > & | getMatrix () const |
| Returns the matrix used to represent this vector. | |
Static Public Attributes | |
| const double | NORMAL_EPSILON = 1e-6 |
| The epsilon to use for determining if a vector is normalized or not. | |
Private Attributes | |
| Matrix< n+1, 1 > | data |
| The matrix representing this point. | |
Friends | |
| template<unsigned int n2> Vector< n2 > | operator- (const Point< n2 > &a, const Point< n2 > &b) |
| Subtracts two points to get a vector. | |
Related Functions | |
| (Note that these are not member functions.) | |
| Vector< n > | operator * (const Vector< n > &a, double b) |
| Multiply a vector by a scalar. | |
| Vector< n > | operator/ (const Vector< n > &a, double b) |
| Divides a vector by a scalar. | |
| Vector< n > | operator * (double b, const Vector< n > &a) |
| Multiplies a scalar by a vector (commutative). | |
| Vector< n > | operator+ (const Vector< n > &a, const Vector< n > &b) |
| Adds two vectors. | |
| Vector< n > | operator- (const Vector< n > &a, const Vector< n > &b) |
| Subtracts two vectors. | |
| double | operator * (const Vector< n > &a, const Vector< n > &b) |
| Finds the dot product (aka scalar product) of two vectors. | |
| std::ostream & | operator<< (std::ostream &, const Vector< n > &) |
| Outputs a Vector to a C++ ostream. | |
Definition at line 191 of file geometry.hh.
|
|||||||||
|
Determines if the vector is normalized. This is useful for inside assertions. Due to floating point imprecision, this is actually a reasonable approximation of a normalization test.
Definition at line 219 of file geometry.hh. References abs(), Vector< n >::getLength(), and Vector< n >::NORMAL_EPSILON. |
|
|||||||||
|
Normalizes this vector, adjusting it to unit length. Due to floating point imprecision, this is actually a reasonable approximation of normalization.
Definition at line 59 of file geometry.impl. References Vector< n >::data, and Vector< n >::getLength(). |
|
|||||||||
|
Translates the current GL context by this vector.
Definition at line 67 of file geometry.impl. References Vector< n >::data. |
|
||||||||||||||||
|
Outputs a Vector to a C++ ostream. The output will be "v<1,2,...,n>". Definition at line 95 of file geometry.impl. |
|
|||||
|
The matrix representing this point. Position (i,0) is the value of dimension i. Position (n,0) is always 0.0. Definition at line 263 of file geometry.hh. Referenced by Vector< n >::getLength(), Vector< n >::getMatrix(), Vector< n >::normalize(), Vector< n >::operator *=(), Vector< n >::operator+=(), Vector< n >::operator-(), Vector< n >::operator-=(), Vector< n >::operator/=(), Vector< n >::operator[](), Vector< n >::translateGL(), and Vector< n >::Vector(). |
|
|||||
|
The epsilon to use for determining if a vector is normalized or not.
Definition at line 4 of file geometry.impl. Referenced by Vector< n >::isNormalized(). |
1.3.5