Isis 3 Programmer Reference
|
This class holds all static methods to perform linear algebra operations on vectors and matrices. More...
#include <LinearAlgebra.h>
Public Types | |
typedef boost::numeric::ublas::matrix< double > | Matrix |
Definition for an Isis::LinearAlgebra::Matrix of doubles. More... | |
typedef boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > | SymmetricMatrix |
Definition for an Isis::LinearAlgebra::SymmetrixMatrix of doubles with an upper configuration. More... | |
typedef boost::numeric::ublas::vector< double > | Vector |
Definition for an Isis::LinearAlgebra::Vector of doubles. More... | |
typedef QPair< Vector, Angle > | AxisAngle |
Definition for an Axis-Angle pair. More... | |
typedef QPair< Angle, int > | EulerAngle |
Definition for an EulerAngle pair. More... | |
Static Public Member Functions | |
static bool | isIdentity (const Matrix &matrix) |
Determines whether the given matrix is the identity. More... | |
static bool | isOrthogonal (const Matrix &matrix) |
Determines whether the given matrix is orthogonal by verifying that the matrix and its tranpose are inverses. More... | |
static bool | isRotationMatrix (const Matrix &matrix) |
Determines whether the given matrix is a rotation matrix. More... | |
static bool | isZero (const Matrix &matrix) |
Determines whether the given matrix is filled with zereos. More... | |
static bool | isZero (const Vector &vector) |
Determines whether the given vector is filled with zereos. More... | |
static bool | isEmpty (const Vector &vector) |
Determines whether the given vector is empty (i.e. More... | |
static bool | isUnit (const Vector &vector) |
Determines whether the given vector is a unit vector. More... | |
static Matrix | identity (int size) |
Returns the identity matrix of size NxN. More... | |
static Matrix | transpose (const Matrix &matrix) |
Returns the transpose of the given matrix. More... | |
static Matrix | inverse (const Matrix &matrix) |
Returns the inverse of a 2x2 or 3x3 matrix. More... | |
static Matrix | zeroMatrix (int rows, int columns) |
Returns a matrix with given dimensions that is filled with zeroes. More... | |
static Vector | zeroVector (int size) |
Returns a vector of given length that is filled with zeroes. More... | |
static double | determinant (const Matrix &matrix) |
Returns the determinant of the given 3x3 matrix. More... | |
static Vector | normalize (const Vector &vector) |
Returns a unit vector that is codirectional with the given vector by dividing each component of the vector by the vector magnitude. More... | |
static double | magnitude (const Vector &vector) |
Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm). More... | |
static double | absoluteMaximum (const Vector &vector) |
Returns the maximum norm (L-infinity norm) for the given vector. More... | |
static Matrix | multiply (const Matrix &matrix1, const Matrix &matrix2) |
Returns the product of two matrices. More... | |
static Vector | multiply (const Matrix &matrix, const Vector &vector) |
Computes the product of the given matrix and vector. More... | |
static Vector | multiply (double scalar, const Vector &vector) |
Multiplies the given scalar and vector. More... | |
static Matrix | multiply (double scalar, const Matrix &matrix) |
Multiplies the given scalar and matrix. More... | |
static Vector | add (const Vector &vector1, const Vector &vector2) |
Adds the two given vectors. More... | |
static Vector | subtract (const Vector &vector1, const Vector &vector2) |
Subtracts the right vector from the left vector. More... | |
static Vector | crossProduct (const Vector &vector1, const Vector &vector2) |
Returns the cross product of two vectors. More... | |
static Vector | normalizedCrossProduct (const Vector &vector1, const Vector &vector2) |
Divides each vector by its corresponding absolute maximum, computes the cross product of the new vectors, and normalizes the resultant vector from the cross product. More... | |
static Matrix | outerProduct (const Vector &vector1, const Vector &vector2) |
Computes the outer product of the given vectors. More... | |
static double | dotProduct (const Vector &vector1, const Vector &vector2) |
Computes the dot product of the given vectors. More... | |
static double | innerProduct (const Vector &vector1, const Vector &vector2) |
Computes the inner product of the given vectors. More... | |
static Vector | project (const Vector &vector1, const Vector &vector2) |
Compute the vector projection of vector1 onto vector2. More... | |
static Vector | rotate (const Vector &vector, const Vector &axis, Angle angle) |
Rotates a vector about an axis vector given a specified angle. More... | |
static Vector | perpendicular (const Vector &vector1, const Vector &vector2) |
Finds the unique vector P such that A = V + P, V is parallel to B and P is perpendicular to B, where A is the first vector (vector1) and B is the second vector (vector2) passed in by the user. More... | |
static AxisAngle | toAxisAngle (const Matrix &rotationMatrix) |
Converts a rotation's representation from a matrix to a axis of rotation and its corresponding rotation angle. More... | |
static Matrix | toMatrix (const AxisAngle &axisAngle) |
Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix. More... | |
static Matrix | toMatrix (const Vector &axis, Angle angle) |
Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix. More... | |
static QList< EulerAngle > | toEulerAngles (const Matrix &rotationMatrix, const QList< int > axes) |
Converts a rotation's representation from a matrix to a set of Euler angles with corresponding axes. More... | |
static Matrix | toMatrix (const QList< EulerAngle > &eulerAngles) |
Converts a rotation's representation from a list of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix. More... | |
static Matrix | toMatrix (const EulerAngle &angle3, const EulerAngle &angle2, const EulerAngle &angle1) |
Converts a rotation's representation from a set of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix. More... | |
static Vector | toQuaternion (const Matrix &rotationMatrix) |
Converts a rotation's representation from a matrix to a unit quaternion. More... | |
static Matrix | toMatrix (const Vector &quaternion) |
Converts a rotation's representation from a quaternion to a 3x3 matrix. More... | |
static void | setRow (Matrix &matrix, const Vector &vector, int rowIndex) |
Sets the row of the given matrix to the values of the given vector. More... | |
static void | setColumn (Matrix &matrix, const Vector &vector, int columnIndex) |
Sets the column of the given matrix to the values of the given vector. More... | |
static Vector | row (const Matrix &matrix, int rowIndex) |
Returns a vector whose components match those of the given matrix row. More... | |
static Vector | column (const Matrix &matrix, int columnIndex) |
Returns a vector whose components match those of the given matrix column. More... | |
static void | setVec3 (Vector *v, double v0, double v1, double v2) |
Fills the first three elements of the given vector with the given values. More... | |
static void | setVec4 (Vector *v, double v0, double v1, double v2, double v3) |
Fills the first four elements of the given vector with the given values. More... | |
static Vector | vector (double v0, double v1, double v2) |
Constructs a 3 dimensional vector with the given component values. More... | |
static Vector | vector (double v0, double v1, double v2, double v3) |
Constructs a 4 dimensional vector with the given component values. More... | |
static Vector | subVector (const Vector &v, int start, int size) |
Constructs a vector of given size using the given vector and starting index. More... | |
Protected Member Functions | |
LinearAlgebra () | |
Default constructor for a LinearAlgebra object. More... | |
~LinearAlgebra () | |
Destructor for a LinearAlgebra object. More... | |
This class holds all static methods to perform linear algebra operations on vectors and matrices.
This class has 4 representations of a 3 dimensional rotation
2013-06-01 Jeannie Backer - Original version.
2013-08-07 Kimberly Oyama - Updated documentation.
2016-07-25 Jeannie Backer - Updated documentation and test.
2016-08-05 Jeannie Backer - Replace std abs() function with qAbs() from QtGlobal.
2016-08-16 Jesse Mapel - Added BOOST_UBLAS_NO_STD_CERR definition to prevent Boost from outputing debug information to standard out when throwing exceptions. Fixes #2302.
2017-12-12 Jeannie Backer - Added SymmetricMatrix typedef.
document methods (a) add naif routine names to documentation where appropriate, (b) clean up comments within methods, (3) use naif documentation where appropriate
add links to naif documentation web pages???
add proper scopes
implement norm2 (L2 norm)?
implement trace?
common validate errors - vector size match, 3x3 matrix, 3D vector
what is more expensive - unitize vector and compare to 1 or isOrthogonal?
rename local variables m2q and q2m
implement qdq2av (Quaternion and quaternion derivative to angular velocity)?
implement qxq (Quaternion times quaternion)?
implement qderiv (Quadratic derivative)?
When converting quaternion, axis-angle, Euler angle to rot matrix, should we verify that the matrix is valid (is a rotation matrix)???
isQuaternion???
should we throw error in q2m if q = 0???
q2m - why check if sharpen when q is not unit if it is required to be a unit? throw an error?
axisar - throw error if axis is origin? If we rotate about about origin, then we get a zero matrix - not a rotation... except maybe trivially... (or do we get identity??? indicating no rotation)
double check all indexing on code copied from NAIF - indices should reverse col/row order and subtract 1
Definition at line 104 of file LinearAlgebra.h.
typedef QPair<Vector, Angle> Isis::LinearAlgebra::AxisAngle |
Definition for an Axis-Angle pair.
This is a three dimensional rotation represented as an axis of rotation and a corresponding rotation angle. AxisAngle is a typedef for a QPair of an Isis::LinearAlgebra::Vector and an Isis::Angle.
Definition at line 144 of file LinearAlgebra.h.
typedef QPair<Angle, int> Isis::LinearAlgebra::EulerAngle |
Definition for an EulerAngle pair.
This is a three dimensional rotation represented as an Euler angle and the number corresponding to its rotation axis. EulerAngle is a typedef for a QPair of an Isis::Angle and an integer (1, 2, or 3).
Definition at line 151 of file LinearAlgebra.h.
typedef boost::numeric::ublas::matrix<double> Isis::LinearAlgebra::Matrix |
Definition for an Isis::LinearAlgebra::Matrix of doubles.
This is a typedef for a boost matrix.
Note: This typedef is used so that we can add functionality to an existing matrix type and/or change which third party library's matrix we are using without changing all references to this type in the ISIS API.
Definition at line 115 of file LinearAlgebra.h.
typedef boost::numeric::ublas::symmetric_matrix<double, boost::numeric::ublas::upper> Isis::LinearAlgebra::SymmetricMatrix |
Definition for an Isis::LinearAlgebra::SymmetrixMatrix of doubles with an upper configuration.
This is a typedef for a boost symmetric_matrix.
Note: This typedef is used so that we can add functionality to an existing matrix type and/or change which third party library's matrix we are using without changing all references to this type in the ISIS API.
Definition at line 125 of file LinearAlgebra.h.
typedef boost::numeric::ublas::vector<double> Isis::LinearAlgebra::Vector |
Definition for an Isis::LinearAlgebra::Vector of doubles.
This is a typedef for a boost vector.
Note: This typedef is used so that we can add functionality to an existing vector type and/or change which third party library's vector we are using without changing all references to this type in the ISIS API.
Definition at line 135 of file LinearAlgebra.h.
|
protected |
Default constructor for a LinearAlgebra object.
This is protected so it can never be constructed. The static methods and typedefs in this class are meant to be used without a LinearAlgebra object.
Definition at line 52 of file LinearAlgebra.cpp.
|
protected |
Destructor for a LinearAlgebra object.
Definition at line 59 of file LinearAlgebra.cpp.
|
static |
Returns the maximum norm (L-infinity norm) for the given vector.
The maximum norm is defined by the absolute values of the vector components:
\( \| v \|_\infty = \max_{i=1}^n \{ \mid v_i \mid \} \)
vector | The vector whose absolute maximum will be returned. |
Definition at line 514 of file LinearAlgebra.cpp.
References vector().
Referenced by magnitude(), normalizedCrossProduct(), and perpendicular().
|
static |
Adds the two given vectors.
vector1 | The first vector. |
vector2 | The second vector. |
IException::Programmer | "Unable to add vectors with mismatched sizes." |
Definition at line 617 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
|
static |
Returns a vector whose components match those of the given matrix column.
matrix | The matrix to pull values from. |
columnIndex | The index of the matrix column to grab. |
IException::Programmer | "Unable to get the matrix column to the given vector. Column index is out of bounds." |
Definition at line 1676 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by isRotationMatrix(), toEulerAngles(), and toMatrix().
|
static |
Returns the cross product of two vectors.
Note: the cross-product requires the vectors to have exactly three components each.
vector1 | The vector to the left of the cross product operator. |
vector2 | The vector to the right of the cross product operator. |
IException::Programmer | "Unable to calculate the cross product on vectors that are not size 3. " |
Definition at line 671 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by normalizedCrossProduct(), and rotate().
|
static |
Returns the determinant of the given 3x3 matrix.
LinearAlgebra::Matrix | The 3x3 matrix whose determinant will be calculated. |
IException::Programmer | "Unable to calculate the determinant for the given matrix. This method only calculates the determinant for 2x2 or 3x3 matrices." |
Definition at line 423 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by inverse(), and isRotationMatrix().
Computes the dot product of the given vectors.
For Euclidean space, this is the same as the inner product, so these methods are interchangeable.
vector1 | The first vector. |
vector2 | The second vector. |
Definition at line 764 of file LinearAlgebra.cpp.
References innerProduct().
Referenced by isUnit(), project(), Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), and Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane().
|
static |
Returns the identity matrix of size NxN.
int | The size of the square matrix. |
IException::Programmer | "Can not create identity matrix of negative size." |
Definition at line 367 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by inverse(), and toMatrix().
Computes the inner product of the given vectors.
For Euclidean space, this is the same as the dot product, so these methods are interchangeable.
vector1 | The first vector. |
vector2 | The second vector. |
IException::Programmer | "Unable to compute the dot product for vectors with mismatched sizes." |
Definition at line 784 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by dotProduct().
|
static |
Returns the inverse of a 2x2 or 3x3 matrix.
Throws an error if the given matrix is not invertible.
matrix | The matrix to inverse. |
IException::Programmer | "The given matrix is not invertible. The determinant is 0.0." |
IException::Programmer | "Unable to invert the given matrix." |
Definition at line 295 of file LinearAlgebra.cpp.
References _FILEINFO_, determinant(), identity(), isOrthogonal(), Isis::IException::Programmer, and transpose().
|
static |
Determines whether the given vector is empty (i.e.
size 0).
vector | The vector to check. |
Definition at line 263 of file LinearAlgebra.cpp.
References vector().
|
static |
Determines whether the given matrix is the identity.
Non-square matrices always return false. A qfuzzycompare is used when checking the zeroes and ones.
matrix | The matrix to check. Automatically returns false if not square. |
Definition at line 74 of file LinearAlgebra.cpp.
References row().
Referenced by isOrthogonal().
|
static |
Determines whether the given matrix is orthogonal by verifying that the matrix and its tranpose are inverses.
matrix | The matrix to check. Automatically returns false if not square. |
Definition at line 102 of file LinearAlgebra.cpp.
References isIdentity(), multiply(), and transpose().
Referenced by inverse().
|
static |
Determines whether the given matrix is a rotation matrix.
matrix | The matrix to check. Automatically returns false if not 2x2 or 3x3. |
IException::Programmer | "Unable to determine whether the given matrix is a rotation matrix." |
Definition at line 126 of file LinearAlgebra.cpp.
References _FILEINFO_, column(), determinant(), magnitude(), Isis::IException::Programmer, and setColumn().
Referenced by toAxisAngle(), toEulerAngles(), and toQuaternion().
|
static |
Determines whether the given vector is a unit vector.
vector | The vector to check. |
Definition at line 275 of file LinearAlgebra.cpp.
References dotProduct(), and vector().
Referenced by toMatrix(), and toQuaternion().
|
static |
Determines whether the given matrix is filled with zereos.
vector | The matrix to check. |
Definition at line 224 of file LinearAlgebra.cpp.
Referenced by magnitude(), normalize(), perpendicular(), project(), rotate(), toAxisAngle(), and toMatrix().
|
static |
Determines whether the given vector is filled with zereos.
vector | The vector to check. |
Definition at line 244 of file LinearAlgebra.cpp.
References vector().
|
static |
Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm).
The maximum norm (L-infinity) is also used to stabilize the solution in order to avoid overflow. This method uses the computation
\( \| v \| = \| v \|_\infty \| \frac{v}{\| v \|_\infty} \|_2 \) where \( \| u \|_\infty = \max_{i=1}^n \{ \mid u_i \mid \} \) is the maximum norm and \( \| u \|_2 = \sqrt{\sum_{i=1}^n u_1^2} \) is the Euclidean norm.
vector | The vector whose magnitude will be computed. |
Definition at line 487 of file LinearAlgebra.cpp.
References absoluteMaximum(), isZero(), and vector().
Referenced by Isis::EmbreeShapeModel::intersectSurface(), isRotationMatrix(), Isis::EmbreeShapeModel::isVisibleFrom(), Isis::EmbreeShapeModel::localRadius(), Isis::EmbreeTargetShape::maximumSceneDistance(), normalize(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), Isis::EmbreeShapeModel::sortHits(), and toAxisAngle().
|
static |
Returns the product of two matrices.
Will throw an error if the matrices are not properly sized (the number of columns of the first matrix must match the number or rows of the second matrix).
matrix1 | The left matrix. |
matrix2 | The right matrix. |
IException::Programmer | "Unable to multiply matrices with mismatched dimensions." |
Definition at line 532 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by isOrthogonal(), Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toEulerAngles().
|
static |
Computes the product of the given matrix and vector.
The vector will be multiplied on the right side of the given matrix. Will throw an error if the two are not properly sized (matrix columns not equal to vector size).
matrix | The matrix to be multiplied. |
vector | The column vector to be multiplied on the right side of the matrix. |
IException::Programmer | "Unable to multiply matrix and vector with mismatched dimensions." |
Definition at line 563 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().
|
static |
Multiplies the given scalar and vector.
scalar | The scalar to be multiplied by each component of the vector. |
vector | The vector to be scaled. |
Definition at line 586 of file LinearAlgebra.cpp.
References vector().
|
static |
Multiplies the given scalar and matrix.
scalar | The scalar to be multiplied by each element of the matrix. |
matrix | The matrix to be scaled. |
Definition at line 600 of file LinearAlgebra.cpp.
|
static |
Returns a unit vector that is codirectional with the given vector by dividing each component of the vector by the vector magnitude.
\( \hat{v} = \frac{v}{\| v \|} \) where \( \| u \|_ \) is the magnitude of u.
vector | The vector to be normalized. |
IException::Programmer | "Unable to normalize the zero vector." |
Definition at line 460 of file LinearAlgebra.cpp.
References _FILEINFO_, isZero(), magnitude(), Isis::IException::Unknown, and vector().
Referenced by Isis::EmbreeTargetShape::getHitInformation(), Isis::EmbreeShapeModel::intersectSurface(), normalizedCrossProduct(), Isis::EmbreeShapeModel::pointToRay(), rotate(), toAxisAngle(), toEulerAngles(), toMatrix(), and toQuaternion().
|
static |
Divides each vector by its corresponding absolute maximum, computes the cross product of the new vectors, and normalizes the resultant vector from the cross product.
Note: the cross-product requires the vectors to have exactly three components each.
vector1 | The vector to the left of the cross product operator. |
vector2 | The vector to the right of the cross product operator. |
Definition at line 704 of file LinearAlgebra.cpp.
References absoluteMaximum(), crossProduct(), and normalize().
|
static |
Computes the outer product of the given vectors.
The outer product operation is defined as the cross product of vector1 and the conjugate transpose of vector2.
vector1 | The vector to the left side of the outer product operator. |
vector2 | The vector to the right side of the outer product operator. |
IException::Programmer | "Unable to compute the outer product for vectors with mismatched sizes." |
Definition at line 740 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
|
static |
Finds the unique vector P such that A = V + P, V is parallel to B and P is perpendicular to B, where A is the first vector (vector1) and B is the second vector (vector2) passed in by the user.
For all vectors A and B, there exists unique vectors V and P such that 1) A = V + P 2) V is parallel to B
3) P is perpendicular to B
vector1 | The first vector, denoted A in the description. |
vector2 | The second vector, denoted B in the description. |
Definition at line 915 of file LinearAlgebra.cpp.
References absoluteMaximum(), isZero(), and project().
|
static |
Compute the vector projection of vector1 onto vector2.
This is the orthogonal projection of vector1 onto a line that is parallel to vector2.
It is defined by \( proj_{v_2} v_1 = \frac{v_1 \cdot v_2}{\| v_2 \|^2}v_2 \) where \( \| u \|_ \) is the magnitude of u.
vector1 | The vector to the left of the project operator. |
vector2 | The vector to the right of the project operator. |
IException::Programmer | "Unable to project vector1 onto vector2 with mismatched sizes." |
Definition at line 816 of file LinearAlgebra.cpp.
References _FILEINFO_, dotProduct(), isZero(), Isis::IException::Programmer, and Isis::toString().
Referenced by perpendicular(), and rotate().
|
static |
Rotates a vector about an axis vector given a specified angle.
Note: this method only rotates a vector with three components since the cross product calculation requires this.
vector | The vector to rotate, which must have three components. |
axis | A vector defining the axis, which must also have three components. |
angle | The angle to rotate. |
IException::Programmer | "Unable to rotate vector about the given axis and angle. Vectors must be of size 3 to perform rotation. " |
Definition at line 855 of file LinearAlgebra.cpp.
References _FILEINFO_, crossProduct(), isZero(), normalize(), Isis::IException::Programmer, project(), Isis::Angle::radians(), Isis::toString(), and vector().
Referenced by toMatrix().
|
static |
Returns a vector whose components match those of the given matrix row.
matrix | The matrix to pull values from. |
rowIndex | The index of the matrix row to grab. |
IException::Programmer | "Unable to get the matrix row to the given vector. Row index is out of bounds." |
Definition at line 1653 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by isIdentity().
|
static |
Sets the column of the given matrix to the values of the given vector.
matrix | The address of the matrix to be altered. |
vector | The vector with the new values. |
columnIndex | The index of the column to be altered. |
IException::Programmer | "Unable to set the matrix column to the given vector. Column index is out of bounds." |
Definition at line 1630 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().
Referenced by isRotationMatrix(), toEulerAngles(), and toMatrix().
Sets the row of the given matrix to the values of the given vector.
matrix | The address of the matrix to be altered. |
vector | The vector with the new values. |
rowIndex | The index of the row to be altered. |
IException::Programmer | "Unable to set the matrix row to the given vector. Row index is out of bounds." |
Definition at line 1609 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().
|
static |
Fills the first three elements of the given vector with the given values.
v | A pointer to a 3-dimensional vector to be filled. |
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
Definition at line 1735 of file LinearAlgebra.cpp.
|
static |
Fills the first four elements of the given vector with the given values.
v | A pointer to a 4-dimensional vector to be filled. |
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
v3 | The fourth component of the vector. |
Definition at line 1751 of file LinearAlgebra.cpp.
|
static |
Subtracts the right vector from the left vector.
vector1 | The vector to the left of the subtraction operator. |
vector2 | The vector to the right of the subtraction operator. |
IException::Programmer | "Unable to subtract vectors with mismatched sizes." |
Definition at line 643 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
|
static |
Constructs a vector of given size using the given vector and starting index.
v | The original vector to get values from. |
startIndex | The index of the original vector, used to indicate the first value that will be copied to the new vector. |
size | The number of elements from the original vector to copy to the new vector. |
Definition at line 1772 of file LinearAlgebra.cpp.
|
static |
Converts a rotation's representation from a matrix to a axis of rotation and its corresponding rotation angle.
rotationMatrix | A matrix representing a rotation. |
IException::Programmer | "Unable to convert the given matrix to an axis of rotation and a rotation angle. A 3x3 matrix is required." @throw IException::Programmer "Unable to convert the given matrix to an axis of rotation and a rotation angle. The given matrix is not a rotation matrix." |
Definition at line 956 of file LinearAlgebra.cpp.
References _FILEINFO_, isRotationMatrix(), isZero(), magnitude(), normalize(), Isis::PI, Isis::IException::Programmer, Isis::Angle::setRadians(), toQuaternion(), and Isis::toString().
|
static |
Converts a rotation's representation from a matrix to a set of Euler angles with corresponding axes.
rotationMatrix | A matrix representing a rotation. |
axes | A list containing the order of axes. |
IException::Programmer | "Unable to convert the given matrix to Euler angles. Exactly 3 axis codes are required." |
IException::Programmer | "Unable to convert the given matrix to Euler angles using the given axis codes. Axis codes must be 1, 2, or 3." |
IException::Programmer | "Unable to convert the given matrix to Euler angles using the given axis codes. The middle axis code must differ from its neighbors." @throw IException::Programmer "Unable to convert the given matrix to Euler angles. A 3x3 matrix is required." @throw IException::Programmer "Unable to convert the given matrix to Euler angles. The given matrix is not a rotation matrix." |
Definition at line 1034 of file LinearAlgebra.cpp.
References _FILEINFO_, column(), isRotationMatrix(), multiply(), normalize(), Isis::IException::Programmer, setColumn(), Isis::Angle::setRadians(), Isis::toString(), transpose(), and zeroMatrix().
|
static |
Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.
axisAngle | The axis-angle pair representation of a rotation |
Definition at line 1425 of file LinearAlgebra.cpp.
Referenced by toMatrix().
|
static |
Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.
axis | The axis of rotation for a rotation. |
angle | The rotation angle. |
IException::Programmer | "Unable to convert the given vector and angle to a rotation matrix. The given vector is not a 3D axis vector." |
Definition at line 1388 of file LinearAlgebra.cpp.
References _FILEINFO_, column(), identity(), Isis::IException::Programmer, rotate(), setColumn(), and Isis::toString().
|
static |
Converts a rotation's representation from a list of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.
eulerAngles | The Euler angle representation of a rotation. |
IException::Programmer | "Unable to convert the given Euler angles to a matrix. Exactly 3 Euler angles are required." |
Definition at line 1528 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, toMatrix(), and Isis::toString().
|
static |
Converts a rotation's representation from a set of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.
angle3 | The third angle and its axis. |
angle2 | The second angle and its axis. |
angle1 | The first angle and its axis. |
IException::Programmer | "Unable to convert the given Euler angles to a matrix using the given axis codes. Axis codes must be 1, 2, or 3." |
Definition at line 1445 of file LinearAlgebra.cpp.
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
|
static |
Converts a rotation's representation from a quaternion to a 3x3 matrix.
Note, if the given vector is not a unit vector or the zero vector, this method will normalize it before computing the corresponding matrix.
quaternion | A unit quaternion representation of a rotation. |
IException::Programmer | "Unable to convert the given vector to a rotation matrix. The given vector is not a quaternion." |
Definition at line 1555 of file LinearAlgebra.cpp.
References _FILEINFO_, isUnit(), isZero(), normalize(), Isis::IException::Programmer, and Isis::toString().
|
static |
Converts a rotation's representation from a matrix to a unit quaternion.
rotationMatrix | A matrix representing a rotation. |
IException::Programmer | "Unable to convert the given matrix to a quaternion. A 3x3 matrix is required. |
IException::Programmer | "Unable to convert the given matrix to an axis of rotation and a rotation angle. The given matrix is not a rotation matrix." |
Definition at line 1194 of file LinearAlgebra.cpp.
References _FILEINFO_, isRotationMatrix(), isUnit(), normalize(), Isis::IException::Programmer, and Isis::toString().
Referenced by toAxisAngle().
|
static |
Returns the transpose of the given matrix.
matrix | The matrix to transpose. |
Definition at line 352 of file LinearAlgebra.cpp.
Referenced by inverse(), isOrthogonal(), and toEulerAngles().
|
static |
Constructs a 3 dimensional vector with the given component values.
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
Definition at line 1697 of file LinearAlgebra.cpp.
Referenced by absoluteMaximum(), Isis::EmbreeShapeModel::intersectSurface(), isEmpty(), isUnit(), Isis::EmbreeShapeModel::isVisibleFrom(), isZero(), magnitude(), multiply(), normalize(), Isis::EmbreeShapeModel::pointToRay(), Isis::RayHitInformation::RayHitInformation(), rotate(), setColumn(), and setRow().
|
static |
Constructs a 4 dimensional vector with the given component values.
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
v3 | The fourth component of the vector. |
Definition at line 1717 of file LinearAlgebra.cpp.
|
static |
Returns a matrix with given dimensions that is filled with zeroes.
rows | The number of rows in the returned matrix. |
columns | The number of colums in the returned matrix. |
Definition at line 391 of file LinearAlgebra.cpp.
Referenced by Isis::RosettaOsirisCamera::initDistortion(), Isis::RosettaOsirisCameraDistortionMap::RosettaOsirisCameraDistortionMap(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toEulerAngles().
|
static |
Returns a vector of given length that is filled with zeroes.
size | Size of the vector. |
Definition at line 404 of file LinearAlgebra.cpp.
Referenced by Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), and Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane().