#include <Array.h>
Public Member Functions | |
Array () | |
Default constructor, does not initialize elements. | |
Array (T x, T y) | |
Constructor taking 2 arguments, only compiles if Array dimension argument is 2. | |
Array (T x, T y, T z) | |
Constructor taking 3 arguments, only compiles if Array dimension argument is 3. | |
Array (T x, T y, T z, T w) | |
Constructor taking 4 arguments, only compiles if Array dimension argument is 4. | |
Array (const Array &v) | |
Copy constructor. | |
template<typename RandomAccessIterator> | |
Array (RandomAccessIterator start) | |
Constructor taking a pointer or other random access iterator and copying all elements into the Array. | |
template<typename RandomAccessIterator> | |
void | setValue (RandomAccessIterator from) |
Takes a pointer or other random access iterator and copies all elements into the Array. | |
template<typename U> | |
Array (const Array< U, Dim > &v) | |
Constructor that takes an Array of a compatible type. | |
template<typename RandomAccessIterator> | |
void | setValueConvert (RandomAccessIterator from) |
Takes a pointer or other random access iterator with compatible value type and copies all elements into the Array. | |
Array & | operator= (const Array &v) |
Assignment operator. | |
void | read (std::istream &is) |
Reads an Array elementwise from a standard istream. | |
void | write (std::ostream &os) const |
Writes an Array elementwise to a standard ostream. | |
const T & | x () const |
Access to first element. | |
T & | x () |
Access to first element. | |
const T & | y () const |
Access to first element. | |
T & | y () |
Access to first element. | |
const T & | z () const |
Access to first element. | |
T & | z () |
Access to first element. | |
const T & | operator[] (int i) const |
Read-only index access. | |
T & | operator[] (int i) |
Index access. | |
const T * | begin () const |
Get a read-only start iterator. | |
T * | begin () |
Get a start iterator. | |
const T * | end () const |
Get a read-only end iterator. | |
T * | end () |
Get a end iterator. | |
int | size () const |
Get the dimension of the Array. | |
T | length2 () const |
Get the square of the euclidian length of the vector. | |
T | length () const |
Get the euclidian length of the vector. | |
T | lengthInf () const |
Get the infinity-norm (or max-norm) length of the vector. | |
T | dist2 (const Array &v) const |
Get the square of the euclidian length of the difference between this vector and another vector. | |
T | dist (const Array &v) const |
Get the euclidian length of the difference between this vector and another vector. | |
T | distInf (const Array &v) const |
Get the infinity-norm (or max-norm) length of the difference between this vector and another vector. | |
void | normalize () |
Normalize this vector, i.e. | |
Array | operator+ (const Array &v) const |
The sum of two vectors. | |
bool | operator== (const Array &v) const |
Add a vector to this vector. | |
Array & | operator+= (const Array &v) |
Add a vector to this vector. | |
Array | operator- (const Array &v) const |
The difference between two vectors. | |
Array & | operator-= (const Array &v) |
Subtract a vector from this vector. | |
Array | operator * (T d) const |
The product of a vector and a scalar. | |
Array & | operator *= (T d) |
Multiply this vector by a scalar. | |
Array | operator/ (double d) const |
A vector divided by a scalar. | |
Array & | operator/= (double d) |
Divide this vector with a scalar. | |
Array | operator- () const |
The negation of a vector. | |
T | operator * (const Array &v) const |
The scalar product (or inner product, or dot product) of two vectors. | |
Array | operator% (const Array &v) const |
The cross product of two vectors. | |
Array | cross (const Array &v) const |
The cross product of two vectors. | |
T | cosAngle (const Array &v) const |
The cosine of the angle between this and another vector. | |
T | angle (const Array &v) const |
The angle between this and another vector. | |
void | zero () |
Sets the vector to the zero vector. |
Encapsulates an array with full value semantics, i.e. copying and assignment works as expected. The class also has some vector algebra functionality, such as scalar product, multiplication by scalars etc. In such contexts the objects are talked about as 'vectors' and not 'Arrays'.
Definition at line 58 of file Array.h.
void Go::Array< T, Dim >::write | ( | std::ostream & | os | ) | const [inline] |
const T& Go::Array< T, Dim >::x | ( | ) | const [inline] |
T& Go::Array< T, Dim >::x | ( | ) | [inline] |
const T& Go::Array< T, Dim >::y | ( | ) | const [inline] |
T& Go::Array< T, Dim >::y | ( | ) | [inline] |
const T& Go::Array< T, Dim >::z | ( | ) | const [inline] |
T& Go::Array< T, Dim >::z | ( | ) | [inline] |
void Go::Array< T, Dim >::normalize | ( | ) | [inline] |
Normalize this vector, i.e.
divide every element by length().
Definition at line 257 of file Array.h.
Referenced by Go::BaryCoordSystemTriangle3D::BaryCoordSystemTriangle3D(), and Go::MatrixXD< double, 3 >::setToRotation().
Array Go::Array< T, Dim >::operator% | ( | const Array< T, Dim > & | v | ) | const [inline] |
The cross product of two vectors.
Only compiles if dimension is 3.
Definition at line 355 of file Array.h.
Referenced by Go::Array< double, Dim >::cross().
Array Go::Array< T, Dim >::cross | ( | const Array< T, Dim > & | v | ) | const [inline] |
The cross product of two vectors.
Only compiles if dimension is 3.
Definition at line 365 of file Array.h.
Referenced by Go::area(), and Go::signed_area().