#include <vector.hxx>

Public Member Functions | |
| double & | component (int i) |
| Extracts the ith component of a vector and allows it to be modified. | |
| double | component (int i) const |
| Returns a copy of the ith component of a vector. | |
| void | debug (FILE *fp=debug_file_ptr) const |
| Outputs debug information to the screen or to the specified file. | |
| void | debug_str (char *str) const |
| Concatenates the debug information to the passed string. | |
| logical | is_zero (const double tol=SPAresabs) const |
| Returns TRUE if the length of the SPAvector is less than the given tolerance. | |
| double | len () const |
| Returns the length of the vector. | |
| double | len_sq () const |
| Returns the length squared, ( x*x + y*y + z*z ). | |
| SPAvector | make_ortho () |
| Returns a SPAvector orthogonal to this SPAvector. | |
| double | max_norm (int &i) const |
| This method returns the maximum of the fabs of each component, and tells which component was the maximum. | |
| double | numerically_stable_len () const |
| Not appropriate for general use. | |
| SPAvector const & | operator*= (SPAtransf const &t) |
| Transforms this vector by an affine transformation. | |
| SPAvector const & | operator*= (SPAmatrix const &m) |
| Transforms this vector by a 3 X 3 matrix. | |
| SPAvector const & | operator*= (double d) |
| Multiplication of a vector by a scalar. | |
| SPAvector const & | operator+= (SPAvector const &v) |
| Adds two vectors. | |
| SPAvector const & | operator-= (SPAvector const &v) |
| Binary minus operation. | |
| SPAvector const & | operator/= (double d) |
| Division of a vector by a scalar. | |
| SPAunit_vector | orthogonal () const |
| Returns a unit vector that is orthogonal to the given vector. | |
| void | set_component (int i, double new_c) |
| Sets the value of ith component of a vector. | |
| void | set_x (double new_x) |
| Sets the x-coordinate of a vector. | |
| void | set_y (double new_y) |
| Sets the y-coordinate of a vector. | |
| void | set_z (double new_z) |
| Sets the z-coordinate of a vector. | |
| SPAvector (SPAvector const &v) | |
| C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument. | |
| SPAvector (double v[3]) | |
| C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments. | |
| SPAvector (double x, double y, double z) | |
| C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments. | |
| SPAvector () | |
| C++ allocation constructor requests memory for this object but does not populate it. | |
| double & | x () |
| Extracts the x-component of a vector for an update and allows it to be modified. | |
| double | x () const |
| Returns the x-component of a vector. | |
| double & | y () |
| Extracts the y-component of a vector for an update and allows it to be modified. | |
| double | y () const |
| Returns the y-component of a vector. | |
| double & | z () |
| Extracts the z-component of a vector for an update and allows it to be modified. | |
| double | z () const |
| Extracts the z-component of a vector. | |
Friends | |
| logical | antiparallel (SPAunit_vector const &v1, SPAunit_vector const &v2, const double res) |
| Determines if two vectors are anti-parallel (within some resolution). | |
| logical | antiparallel (SPAunit_vector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are anti-parallel (within some resolution). | |
| logical | antiparallel (SPAvector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are anti-parallel (within some resolution). | |
| logical | biparallel (SPAunit_vector const &v1, SPAunit_vector const &v2, const double res) |
| Determines if two vectors are bi-parallel (within some resolution). | |
| logical | biparallel (SPAunit_vector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are bi-parallel (within some resolution). | |
| logical | biparallel (SPAvector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are bi-parallel (within some resolution). | |
| SPAunit_vector | normalise (SPAvector const &v) |
| Converts a vector into a unit vector. | |
| double | operator% (SPAunit_vector const &uv, SPAposition const &p) |
| Returns the dot-product of a unit vector and a position. | |
| double | operator% (SPAposition const &p, SPAunit_vector const &uv) |
| Returns the dot-product of a position and a unit vector. | |
| double | operator% (SPAvector const &v, SPAposition const &p) |
| Returns the scalar product of vector with a position. | |
| double | operator% (SPAposition const &p, SPAvector const &v) |
| Returns the scalar product of a position with a vector. | |
| double | operator% (SPAvector const &v1, SPAvector const &v2) |
| Returns the scalar product (that is, the dot product) of two vectors. | |
| SPAvector | operator* (SPAvector const &v, SPAtransf const *t) |
| Transforms a vector by an affine transformation. | |
| SPAvector | operator* (SPAvector const &v, SPAtransf const &t) |
| Transforms a vector by an affine transformation. | |
| SPAvector | operator* (SPAvector const &v, SPAmatrix const &m) |
| Transforms a vector by a 3 X 3 matrix. | |
| SPAvector | operator* (SPAmatrix const &m, SPAvector const &v) |
| Transforms a vector by a 3 X 3 matrix. | |
| SPAvector | operator* (SPAvector const &v, double d) |
| Multiplies a vector by a scalar value. | |
| SPAvector | operator* (double d, SPAvector const &v) |
| Multiplies a vector by a scalar value. | |
| SPAvector | operator* (SPAvector const &v1, SPAvector const &v2) |
| Cross product of two vectors - Also applies to unit vectors. | |
| SPAvector | operator+ (SPAvector const &v1, SPAvector const &v2) |
| Addition of two vectors. | |
| SPAvector | operator- (SPAvector const &v1, SPAvector const &v2) |
| Binary minus operation. | |
| SPAvector | operator- (SPAvector const &nv) |
| Unary minus operator. | |
| SPAvector | operator/ (SPAvector const &v, double d) |
| Division of a vector by a scalar. | |
| logical | parallel (SPAunit_vector const &v1, SPAunit_vector const &v2, const double res) |
| Determines if two vectors are parallel (within some resolution). | |
| logical | parallel (SPAunit_vector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are parallel (within some resolution). | |
| logical | parallel (SPAvector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are parallel (within some resolution). | |
| logical | perpendicular (SPAunit_vector const &v1, SPAunit_vector const &v2, const double res) |
| Determines if two vectors are perpendicular (within some resolution). | |
| logical | perpendicular (SPAunit_vector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are perpendicular (within some resolution). | |
| logical | perpendicular (SPAvector const &v1, SPAvector const &v2, const double res) |
| Determines if two vectors are perpendicular (within some resolution). | |
| logical | same_vector (SPAvector const &v1, SPAvector const &v2, const double res) |
| Determines whether or not two vectors are the same. | |
| SPAvector::SPAvector | ( | ) | [inline] |
C++ allocation constructor requests memory for this object but does not populate it.
| SPAvector::SPAvector | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) | [inline] |
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
Role: Creates a SPAvector from three doubles representing the x, y, and z coordinate values.
| x | x-coordinate. | |
| y | y-coordinate. | |
| z | z-coordinate. |
| SPAvector::SPAvector | ( | double | v[3] | ) | [inline] |
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
| v | array of 3 doubles. |
| SPAvector::SPAvector | ( | SPAvector const & | v | ) | [inline] |
C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.
| v | vector. |
| double& SPAvector::component | ( | int | i | ) | [inline] |
Extracts the ith component of a vector and allows it to be modified.
| i | ith component. |
| double SPAvector::component | ( | int | i | ) | const [inline] |
Returns a copy of the ith component of a vector.
| i | ith component. |
| void SPAvector::debug | ( | FILE * | fp = debug_file_ptr |
) | const |
Outputs debug information to the screen or to the specified file.
| fp | file pointer. |
| void SPAvector::debug_str | ( | char * | str | ) | const |
Concatenates the debug information to the passed string.
| str | string. |
| logical SPAvector::is_zero | ( | const double | tol = SPAresabs |
) | const |
Returns TRUE if the length of the SPAvector is less than the given tolerance.
| tol | zero tolerance. |
| double SPAvector::len | ( | ) | const [inline] |
Returns the length of the vector.
| double SPAvector::len_sq | ( | ) | const [inline] |
Returns the length squared, ( x*x + y*y + z*z ).
Faster to compute than calling the len method.
| double SPAvector::max_norm | ( | int & | i | ) | const |
This method returns the maximum of the fabs of each component, and tells which component was the maximum.
Role: In case of a "tie" the index, i, will default to the larger index. For example, given the vector (1, 1, 1), i = 2.
| i | index of max component. |
| double SPAvector::numerically_stable_len | ( | ) | const |
Not appropriate for general use.
Role: This method is more expensive than len, but (theoretically) gives the same value and is stable for very small (those for which v%v would be lost in numerical noise) or very large norms (those for which v%v would give overflow).
Transforms this vector by an affine transformation.
| t | transform. |
Reimplemented in SPAunit_vector.
Transforms this vector by a 3 X 3 matrix.
| m | matrix |
| SPAvector const& SPAvector::operator*= | ( | double | d | ) | [inline] |
Multiplication of a vector by a scalar.
| d | scalar value. |
Adds two vectors.
| v | vector. |
Binary minus operation.
| v | vector. |
| SPAvector const& SPAvector::operator/= | ( | double | d | ) |
Division of a vector by a scalar.
| d | scalar value. |
| SPAunit_vector SPAvector::orthogonal | ( | ) | const |
Returns a unit vector that is orthogonal to the given vector.
If the given vector is less than SPAresmch in length, this method returns the unit vector (0,0,1).
| void SPAvector::set_component | ( | int | i, | |
| double | new_c | |||
| ) | [inline] |
Sets the value of ith component of a vector.
| i | ith component. | |
| new_c | new value. |
| void SPAvector::set_x | ( | double | new_x | ) | [inline] |
Sets the x-coordinate of a vector.
| new_x | x-coordinate. |
| void SPAvector::set_y | ( | double | new_y | ) | [inline] |
Sets the y-coordinate of a vector.
| new_y | y-coordinate. |
| void SPAvector::set_z | ( | double | new_z | ) | [inline] |
Sets the z-coordinate of a vector.
| new_z | z-coordinate. |
| double& SPAvector::x | ( | ) | [inline] |
Extracts the x-component of a vector for an update and allows it to be modified.
| double SPAvector::x | ( | ) | const [inline] |
Returns the x-component of a vector.
| double& SPAvector::y | ( | ) | [inline] |
Extracts the y-component of a vector for an update and allows it to be modified.
| double SPAvector::y | ( | ) | const [inline] |
Returns the y-component of a vector.
| double& SPAvector::z | ( | ) | [inline] |
Extracts the z-component of a vector for an update and allows it to be modified.
| double SPAvector::z | ( | ) | const [inline] |
Extracts the z-component of a vector.
| logical antiparallel | ( | SPAunit_vector const & | v1, | |
| SPAunit_vector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are anti-parallel (within some resolution).
"Anti-parallel" indicates that the vectors are parallel, but in opposite directions. The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| logical antiparallel | ( | SPAunit_vector const & | v1, | |
| SPAvector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are anti-parallel (within some resolution).
"Anti-parallel" indicates that the vectors are parallel, but in opposite directions. The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
Determines if two vectors are anti-parallel (within some resolution).
"Anti-parallel" indicates that the vectors are parallel, but in opposite directions. The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| logical biparallel | ( | SPAunit_vector const & | v1, | |
| SPAunit_vector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are bi-parallel (within some resolution).
"Bi-parallel" indicates that the vectors are parallel and may be in either the same or opposite directions. The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| logical biparallel | ( | SPAunit_vector const & | v1, | |
| SPAvector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are bi-parallel (within some resolution).
"Bi-parallel" indicates that the vectors are parallel and may be in either the same or opposite directions. The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
Determines if two vectors are bi-parallel (within some resolution).
"Bi-parallel" indicates that the vectors are parallel and may be in either the same or opposite directions. The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| SPAunit_vector normalise | ( | SPAvector const & | v | ) | [friend] |
Converts a vector into a unit vector.
Effect: Read-only
| v | vector. |
Reimplemented in SPAunit_vector.
| double operator% | ( | SPAunit_vector const & | uv, | |
| SPAposition const & | p | |||
| ) | [friend] |
Returns the dot-product of a unit vector and a position.
| uv | unit vector. | |
| p | position. |
Reimplemented in SPAunit_vector.
| double operator% | ( | SPAposition const & | p, | |
| SPAunit_vector const & | uv | |||
| ) | [friend] |
Returns the dot-product of a position and a unit vector.
| p | position. | |
| uv | unit vector. |
Reimplemented in SPAunit_vector.
| double operator% | ( | SPAvector const & | v, | |
| SPAposition const & | p | |||
| ) | [friend] |
Returns the scalar product of vector with a position.
| v | vector. | |
| p | position. |
| double operator% | ( | SPAposition const & | p, | |
| SPAvector const & | v | |||
| ) | [friend] |
Returns the scalar product of a position with a vector.
| p | position. | |
| v | vector. |
Returns the scalar product (that is, the dot product) of two vectors.
| v1 | first vector. | |
| v2 | second vector. |
Transforms a vector by an affine transformation.
| v | vector. | |
| t | transformation. |
Transforms a vector by an affine transformation.
| v | vector. | |
| t | transformation. |
Transforms a vector by a 3 X 3 matrix.
| v | vector. | |
| m | matrix. |
Transforms a vector by a 3 X 3 matrix.
| m | matrix. | |
| v | vector. |
Multiplies a vector by a scalar value.
| v | vector. | |
| d | scalar value. |
Multiplies a vector by a scalar value.
| d | scalar value. | |
| v | vector. |
Cross product of two vectors - Also applies to unit vectors.
| v1 | first vector. | |
| v2 | second vector. |
Addition of two vectors.
| v1 | first vector. | |
| v2 | second vector. |
Binary minus operation.
| v1 | first vector. | |
| v2 | second vector. |
Unary minus operator.
Role: Returns the negation of the given vector.
| nv | given vector. |
Division of a vector by a scalar.
| v | vector. | |
| d | scalar value. |
| logical parallel | ( | SPAunit_vector const & | v1, | |
| SPAunit_vector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are parallel (within some resolution).
The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| logical parallel | ( | SPAunit_vector const & | v1, | |
| SPAvector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are parallel (within some resolution).
The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
Determines if two vectors are parallel (within some resolution).
The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| logical perpendicular | ( | SPAunit_vector const & | v1, | |
| SPAunit_vector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are perpendicular (within some resolution).
The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
| logical perpendicular | ( | SPAunit_vector const & | v1, | |
| SPAvector const & | v2, | |||
| const double | res | |||
| ) | [friend] |
Determines if two vectors are perpendicular (within some resolution).
The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
Determines if two vectors are perpendicular (within some resolution).
The default tolerance is SPAresnor.
Effect: Read-only
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution. |
Determines whether or not two vectors are the same.
The default tolerance is SPAresabs.
Effect: System routine
| v1 | first vector. | |
| v2 | second vector. | |
| res | resolution for comparison. |