Inheritance diagram for NdVector:
Definition at line 202 of file Geometry.H.
Public Member Functions | |
NdVector (const int dimension) | |
Alocate a vector of the given dimension. | |
NdVector (const int dimension, const T &value) | |
Allocate a vector of the given dimension, and set all of its elements to the given value. | |
NdVector (const NdPoint< T > &p1, const NdPoint< T > &p2) | |
Allocate a vector from point p1 to point p2 . | |
NdVector (const NdVector< T > &vector) | |
~NdVector () | |
bool | operator== (const NdVector< T > &vec) const |
Dimension | |
int | n () const |
| |
Operations | |
NdVector< T > | operator * (const double scalar) const |
Multiply the length of the vector by a scalar. | |
NdVector< T > | operator/ (const double scalar) const |
Divide the length of the vector by a scalar. | |
NdVector< T > & | operator *= (const double scalar) |
Multiply the length of the vector by a scalar. | |
NdVector< T > & | operator/= (const double scalar) |
Divide the length of the vector by a scalar. | |
NdVector< T > | operator+ (const NdVector< T > &vector) const |
Add two vectors together. | |
NdVector< T > | operator- (const NdVector< T > &vector) const |
Subtract one vector from another. | |
NdVector< T > & | operator+= (const NdVector< T > &vector) |
Add a vector to the current instance. | |
NdVector< T > & | operator-= (const NdVector< T > &vector) |
Subtract a vector from the current instance. | |
NdVector< T > | operator- () const |
Reverse the direction of a vector. | |
double | operator * (const NdVector< T > &vector) |
Calculate the inner (dot) product of two vectors. | |
double | length () const |
| |
void | normalize (const double new_length=1.0) |
Set the length of the vector to the specified value. |
NdVector | ( | const int | dimension | ) | [inline, explicit] |
Alocate a vector of the given dimension.
[in] | dimension | The dimension of the vector. |
Definition at line 206 of file Geometry.H.
NdVector | ( | const int | dimension, | |
const T & | value | |||
) | [inline] |
Allocate a vector of the given dimension, and set all of its elements to the given value.
[in] | dimension | The dimension of the vector. |
[in] | value | The value to set the elements to. |
Definition at line 210 of file Geometry.H.
Allocate a vector from point p1
to point p2
.
[in] | p1 | The starting point. |
[in] | p2 | The ending point. |
Definition at line 214 of file Geometry.H.
Definition at line 216 of file Geometry.H.
~NdVector | ( | ) | [inline] |
Definition at line 217 of file Geometry.H.
bool operator== | ( | const NdVector< T > & | vec | ) | const [inline] |
Check if two vectors are the same.
[in] | point | The point to check against. |
Definition at line 223 of file Geometry.H.
References n().
int n | ( | ) | const [inline] |
Definition at line 231 of file Geometry.H.
References size.
Referenced by length(), operator *(), operator+(), NdPoint::operator+(), operator+=(), NdPoint::operator+=(), operator-(), NdPoint::operator-(), operator-=(), NdPoint::operator-=(), operator==(), and operator>>().
NdVector<T> operator * | ( | const double | scalar | ) | const [inline] |
Multiply the length of the vector by a scalar.
[in] | scalar | The number to multiply the vector by. |
Definition at line 240 of file Geometry.H.
NdVector<T> operator/ | ( | const double | scalar | ) | const [inline] |
Divide the length of the vector by a scalar.
[in] | scalar | The number to divide the vector by. |
Definition at line 246 of file Geometry.H.
NdVector<T>& operator *= | ( | const double | scalar | ) | [inline] |
Multiply the length of the vector by a scalar.
[in] | scalar | The number to multiply the vector by. |
Definition at line 253 of file Geometry.H.
NdVector<T>& operator/= | ( | const double | scalar | ) | [inline] |
Divide the length of the vector by a scalar.
[in] | scalar | The number to divide the vector by. |
Definition at line 259 of file Geometry.H.
Referenced by normalize().
Add two vectors together.
[in] | vector | The vector to add. |
Definition at line 266 of file Geometry.H.
References n().
Subtract one vector from another.
[in] | vector | The vector to subtract. |
Definition at line 272 of file Geometry.H.
References n().
Add a vector to the current instance.
[in] | vector | The vector to add. |
Definition at line 279 of file Geometry.H.
References n().
Subtract a vector from the current instance.
[in] | vector | The vector to subtract. |
Definition at line 286 of file Geometry.H.
References n().
NdVector<T> operator- | ( | ) | const [inline] |
Reverse the direction of a vector.
Definition at line 293 of file Geometry.H.
References n().
double operator * | ( | const NdVector< T > & | vector | ) | [inline] |
Calculate the inner (dot) product of two vectors.
[in] | vector | The second vector. |
Definition at line 301 of file Geometry.H.
References n().
double length | ( | ) | const [inline] |
Definition at line 308 of file Geometry.H.
References n().
Referenced by normalize().
void normalize | ( | const double | new_length = 1.0 |
) | [inline] |
Set the length of the vector to the specified value.
[in] | new_length | The new length of the vector. |
Definition at line 318 of file Geometry.H.
References length(), and operator/=().