OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022

#include <VcstMath.h>

Static Public Member Functions

static double calculateMag (const double aVector[VEC_SIZE])
 
static double calcQuatMag (const double aQuat[QUAT_SIZE])
 
static void calculateCross (const double aUvector[VEC_SIZE], const double aVvector[VEC_SIZE], double anOutVector[VEC_SIZE])
 
static double calculateDot (const double aUvector[VEC_SIZE], const double aVvector[VEC_SIZE])
 
static double calculateDotQuat (const double aUquat[QUAT_SIZE], const double aVquat[QUAT_SIZE])
 
static void applyScalar (const double aScalar, double aVector[VEC_SIZE])
 
static void applyScalarQuat (const double aScalar, double aQuat[QUAT_SIZE])
 
static void conjugateQuat (const double aQuat[QUAT_SIZE], double outQuat[QUAT_SIZE])
 
static void quatMultiply (const double q1[QUAT_SIZE], const double q2[QUAT_SIZE], double outQuat[QUAT_SIZE])
 
static void quatMultiplyMatrix (const double q1[QUAT_SIZE], const double q2[QUAT_SIZE], double outQuat[QUAT_SIZE])
 
static void matrixMultiply (const double aM1[VEC_SIZE][VEC_SIZE], const double aM2[VEC_SIZE][VEC_SIZE], double outMatrix[VEC_SIZE][VEC_SIZE])
 
static void matrixMultiply (const int dimM, const int dimN, const int dimP, const double *aMByN, const double *aNByP, double *outMatrix)
 
static void transposeMatrix (const double inMatrix[VEC_SIZE][VEC_SIZE], double outMatrix[VEC_SIZE][VEC_SIZE])
 
static void transposeQuat (const double inQuat[QUAT_SIZE], double outQuat[QUAT_SIZE])
 
static void printMatrixCOut (const double aMatrix[VEC_SIZE][VEC_SIZE])
 
static void printVectorCOut (const double aVector[VEC_SIZE])
 
static void printQuaternionCOut (const double aQuat[QUAT_SIZE])
 
static void matrixVectorProduct (const double aMatrix[VEC_SIZE][VEC_SIZE], const double aVector[VEC_SIZE], double outVec[VEC_SIZE])
 
static void calculateUnitVector (const double aVector[VEC_SIZE], double unitVector[VEC_SIZE])
 
static void normalizeQuat (double aQuat[QUAT_SIZE])
 
static void inverseMatrix (const double matA[VEC_SIZE][VEC_SIZE], double matR[VEC_SIZE][VEC_SIZE])
 
static void rotationMatrix (const double angle, const short axis, double outMatrix[VEC_SIZE][VEC_SIZE])
 
static double calculateDeterminant (const double matA[VEC_SIZE][VEC_SIZE])
 
static void cofactorMatrix (const double matA[VEC_SIZE][VEC_SIZE], double cof[VEC_SIZE][VEC_SIZE])
 

Detailed Description

The VcstMath class contains general math functions.

Definition at line 22 of file VcstMath.h.

Member Function Documentation

◆ applyScalar()

static void applyScalar ( const double  aScalar,
double  aVector[VEC_SIZE] 
)
static

This function will apply a scalar value to each component of a vector.

Parameters
aScalarInput scalar value
aVectorInput/Output vector with scalar applied
Returns
void

◆ applyScalarQuat()

static void applyScalarQuat ( const double  aScalar,
double  aQuat[QUAT_SIZE] 
)
static

This function will apply a scalar value to each component of a quaternion.

Parameters
aScalarInput scalar value
aQuatInput/Output quaternion with scalar applied
Returns
void

◆ calcQuatMag()

static double calcQuatMag ( const double  aQuat[QUAT_SIZE])
static

This function computes the magnitude of a quaternion.

Parameters
aQuatInput quaternion
Returns
double

◆ calculateCross()

static void calculateCross ( const double  aUvector[VEC_SIZE],
const double  aVvector[VEC_SIZE],
double  anOutVector[VEC_SIZE] 
)
static

This function produces the cross product of 2 vectors.

aUvector Input vector aVvector Input vector anOutVector Output cross product

Returns
PRO_SUCCESS or an error code

◆ calculateDeterminant()

static double calculateDeterminant ( const double  matA[VEC_SIZE][VEC_SIZE])
static

This function calculates the determinant of a matrix.

Parameters
matAInput matrix
Returns
double

◆ calculateDot()

static double calculateDot ( const double  aUvector[VEC_SIZE],
const double  aVvector[VEC_SIZE] 
)
static

This function calculates the dot product of 2 vectors.

Parameters
aUvectorInput vector
aVvectorInput vector
Returns
double

◆ calculateDotQuat()

static double calculateDotQuat ( const double  aUquat[QUAT_SIZE],
const double  aVquat[QUAT_SIZE] 
)
static

This function calculates the dot product of 2 quaternions.

Parameters
aUquatInput quaternion
aVquatInput quaternion
Returns
double

◆ calculateMag()

static double calculateMag ( const double  aVector[VEC_SIZE])
static

This function computes the magnitude of a vector.

Parameters
aVectorInput vector
Returns
double

◆ calculateUnitVector()

static void calculateUnitVector ( const double  aVector[VEC_SIZE],
double  unitVector[VEC_SIZE] 
)
static

This function creates a unit vector.

Parameters
aVectorInput vector
unitVectorOutput unit vector
Returns
Void

◆ cofactorMatrix()

static void cofactorMatrix ( const double  matA[VEC_SIZE][VEC_SIZE],
double  cof[VEC_SIZE][VEC_SIZE] 
)
static

This function calculates the cofactor of a matrix.

Parameters
matAInput matrix
cofOutput cofactor matrix
Returns
Void

◆ conjugateQuat()

static void conjugateQuat ( const double  aQuat[QUAT_SIZE],
double  outQuat[QUAT_SIZE] 
)
static

This function calculates the conjugate of a quaternion.

The conjugate of a quaternion Q, is Q* which has the property that Q X Q* = 1 using quaternion multiplication. Where 1 is the identity quaternion, or the real value 1.0. In quaternion notation (q1,q2,q3,q4) this is (0,0,0,1). The conjugate of a quaternion Q, is formed by reversing the signs of the vector part and not the scalar, so: Q* = (-q1, -q2, -q3, q4)

Parameters
aQuatInput quaternion Q
outQuatOutput quaternion conjugate Q*
Returns
Void

◆ inverseMatrix()

static void inverseMatrix ( const double  matA[VEC_SIZE][VEC_SIZE],
double  matR[VEC_SIZE][VEC_SIZE] 
)
static

This function creates the inverse of a 3x3 matrix.

Parameters
matAInput matrix
matROutput inverse of input matrix
Returns
Void

◆ matrixMultiply() [1/2]

static void matrixMultiply ( const double  aM1[VEC_SIZE][VEC_SIZE],
const double  aM2[VEC_SIZE][VEC_SIZE],
double  outMatrix[VEC_SIZE][VEC_SIZE] 
)
static

This function will multiply two matrices together.

Parameters
aM1Input matrix
aM2Input matrix
outMatrixOutput product of the 2 input matrices
Returns
void

◆ matrixMultiply() [2/2]

static void matrixMultiply ( const int  dimM,
const int  dimN,
const int  dimP,
const double *  aMByN,
const double *  aNByP,
double *  outMatrix 
)
static

This function will multiply two matrices (MByN NByP) together.

Parameters
dimMInput Dimension of M.
dimNInput Dimension of N.
dimPInput Dimension of P.
aMByNInput matrix
aNByPInput matrix
outMatrixOutput product of the 2 input matrices
Returns
void

◆ matrixVectorProduct()

static void matrixVectorProduct ( const double  aMatrix[VEC_SIZE][VEC_SIZE],
const double  aVector[VEC_SIZE],
double  outVec[VEC_SIZE] 
)
static

This function multiplies a matrix times a vector.

Parameters
aMatrixInput matrix
aVectorInput vector
Returns
Void

◆ normalizeQuat()

static void normalizeQuat ( double  aQuat[QUAT_SIZE])
static

This function normalizes a quaternion. This is the analog to calculateUnitVector() for quaternions. By definition, |Q| = sqrt(q1*q1 + q2*q2 + q3*q3 + q4*q4) = 1.

Parameters
aQuatInput/Output quaternion
Returns
Void

◆ printMatrixCOut()

static void printMatrixCOut ( const double  aMatrix[VEC_SIZE][VEC_SIZE])
static

This function will print the contents of a matrix. This method is for debugging and unit test only.

Parameters
aMatrixInput matrix
Returns
Void

◆ printQuaternionCOut()

static void printQuaternionCOut ( const double  aQuat[QUAT_SIZE])
static

This function will print the contents of a quaternion. This method is for debugging and unit test only.

Parameters
aQuatInput quaternion
Returns
Void

◆ printVectorCOut()

static void printVectorCOut ( const double  aVector[VEC_SIZE])
static

This function will print the contents of a vector. This method is for debugging and unit test only.

Parameters
aVectorInput vector
Returns
Void

◆ quatMultiply()

static void quatMultiply ( const double  q1[QUAT_SIZE],
const double  q2[QUAT_SIZE],
double  outQuat[QUAT_SIZE] 
)
static

This function will multiply two quaternions together.

q1 Input quaternion q2 Input quaternion outQuat Output quaternion product

Returns
PRO_SUCCESS or an error code

◆ quatMultiplyMatrix()

static void quatMultiplyMatrix ( const double  q1[QUAT_SIZE],
const double  q2[QUAT_SIZE],
double  outQuat[QUAT_SIZE] 
)
static

This alternate function will multiply two quaternions together using common matrix notation.

q1 Input quaternion q2 Input quaternion outQuat Output quaternion product

Returns
PRO_SUCCESS or an error code

◆ rotationMatrix()

static void rotationMatrix ( const double  angle,
const short  axis,
double  outMatrix[VEC_SIZE][VEC_SIZE] 
)
static

This function creates a rotation matrix through the specified angle about the specified axis.

Parameters
angleInput angle of positive rotation
axisInput axis of positive rotation
matROutput rotation matrix
Returns
Void

◆ transposeMatrix()

static void transposeMatrix ( const double  inMatrix[VEC_SIZE][VEC_SIZE],
double  outMatrix[VEC_SIZE][VEC_SIZE] 
)
static

This function will transpose a matrix.

Parameters
inMatrixInput matrix
outMatrixOutput transpose of input matrix
Returns
void

◆ transposeQuat()

static void transposeQuat ( const double  inQuat[QUAT_SIZE],
double  outQuat[QUAT_SIZE] 
)
static

This function will transpose a quaternion. NOTE: for quaternions, the transpose is the inverse. For the quaternion Q = q1 q2 q3 q4, the inverse is -Q = -q1 -q2 -q3 -q4

Parameters
inQuatInput quaternion
outQuatOutput transpose of input quaternion
Returns
void

The documentation for this class was generated from the following file:
  • /gfs-oceanweb/web/ocssw/ocssw_src/include/ViirsCmn/VcstMath.h