![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Square matrix. More...
#include <SquareMatrix.h>
Public Member Functions | |
| SquareMatrixTpl () | |
| Default constructor. More... | |
| SquareMatrixTpl (unsigned size) | |
| Constructor with a given size. More... | |
| SquareMatrixTpl (const SquareMatrixTpl< double > &mat) | |
| Constructor from another double matrix. More... | |
| SquareMatrixTpl (const SquareMatrixTpl< float > &mat) | |
| Constructor from another float matrix. More... | |
| SquareMatrixTpl (const float M16f[], bool rotationOnly=false) | |
| "From OpenGl" constructor (float version) More... | |
| SquareMatrixTpl (const double M16d[], bool rotationOnly=false) | |
| "From OpenGl" constructor (double version) More... | |
| virtual | ~SquareMatrixTpl () |
| Default destructor. More... | |
| SquareMatrixTpl (const Eigen::Matrix< Scalar, 3, 3 > &mat) | |
| Copy Function. More... | |
| SquareMatrixTpl (const Eigen::Matrix< Scalar, 4, 4 > &mat) | |
| SquareMatrixTpl & | operator= (const Eigen::Matrix< Scalar, 3, 3 > &mat) |
| Assignment Function. More... | |
| SquareMatrixTpl & | operator= (const Eigen::Matrix< Scalar, 4, 4 > &mat) |
| void | toArray (Scalar data[]) |
| unsigned | size () const |
| Returns matrix size. More... | |
| bool | isValid () const |
| Returns matrix validity. More... | |
| void | invalidate () |
| Invalidates matrix. More... | |
| Scalar * | row (unsigned index) |
| Returns pointer to matrix row. More... | |
| void | setValue (unsigned row, unsigned column, Scalar value) |
| Sets a particular matrix value. More... | |
| Scalar | getValue (unsigned row, unsigned column) const |
| Returns a particular matrix value. More... | |
| SquareMatrixTpl & | operator= (const SquareMatrixTpl &B) |
| Matrix copy operator. More... | |
| SquareMatrixTpl | operator+ (const SquareMatrixTpl &B) const |
| Addition. More... | |
| const SquareMatrixTpl & | operator+= (const SquareMatrixTpl &B) |
| In-place addition. More... | |
| SquareMatrixTpl | operator- (const SquareMatrixTpl &B) const |
| Subtraction. More... | |
| const SquareMatrixTpl & | operator-= (const SquareMatrixTpl &B) |
| In-place subtraction. More... | |
| SquareMatrixTpl | operator* (const SquareMatrixTpl &B) const |
| Multiplication (M = A*B) More... | |
| Vector3Tpl< Scalar > | operator* (const Vector3Tpl< Scalar > &V) const |
| Multiplication by a vector. More... | |
| const SquareMatrixTpl & | operator*= (const SquareMatrixTpl &B) |
| In-place multiplication. More... | |
| void | apply (const float vec[], float result[]) const |
| Multiplication by a float vector, outputs a float vector. More... | |
| void | apply (const float vec[], double result[]) const |
| Multiplication by a float vector, outputs a double vector. More... | |
| void | apply (const double vec[], double result[]) const |
| Multiplication by a double vector. More... | |
| void | transpose () |
| In-place transpose. More... | |
| SquareMatrixTpl | transposed () const |
| Returns the transposed version of this matrix. More... | |
| void | clear () |
| Sets all elements to 0. More... | |
| SquareMatrixTpl | inv () const |
| Returns inverse (Gauss) More... | |
| void | print (FILE *fp=nullptr) const |
| Prints out matrix to console or file. More... | |
| void | toIdentity () |
| Sets matrix to identity. More... | |
| void | scale (Scalar coef) |
| Scales matrix (all elements are multiplied by the same coef.) More... | |
| Scalar | trace () const |
| Returns trace. More... | |
| double | computeDet () const |
| Returns determinant. More... | |
| void | initFromQuaternion (const float q[]) |
| Creates a rotation matrix from a quaternion (float version) More... | |
| void | initFromQuaternion (const double q[]) |
| Creates a rotation matrix from a quaternion (double version) More... | |
| bool | toQuaternion (double q[]) |
| Converts rotation matrix to quaternion. More... | |
| Scalar | deltaDeterminant (unsigned column, Scalar *Vec) const |
| Returns Delta-determinant (see Kramer formula) More... | |
| void | toGlMatrix (float M16f[]) const |
| Converts a 3*3 or 4*4 matrix to an OpenGL-style float matrix (float[16]) More... | |
| void | toGlMatrix (double M16d[]) const |
| bool | svd (SquareMatrixTpl &S, SquareMatrixTpl &U, SquareMatrixTpl &V) const |
Public Attributes | |
| Scalar ** | m_values = nullptr |
| The matrix rows. More... | |
Square matrix.
Row-major ordered matrix (i.e. elements are accessed with 'values[row][column]')
|
inline |
Default constructor.
Warning: invalid matrix.
Referenced by cloudViewer::SquareMatrixTpl< double >::inv().
|
inline |
Constructor with a given size.
| size | the (square) matrix dimension |
|
inline |
Constructor from another double matrix.
| mat | matrix |
|
inline |
Constructor from another float matrix.
| mat | matrix |
|
inline |
"From OpenGl" constructor (float version)
The matrix dimension is automatically set to 4. It can be forced to 3 (size_3 = true). In this case, only the rotation part will be 'imported'.
| M16f | a table of 16 floats (OpenGL float transformation matrix) |
| rotationOnly | consider only the roation part (3x3 matrix) |
|
inline |
"From OpenGl" constructor (double version)
The matrix dimension is automatically set to 4. It can be forced to 3 (size_3 = true). In this case, only the rotation part will be 'imported'.
| M16d | a table of 16 floats (OpenGL double transformation matrix) |
| rotationOnly | consider only the roation part (3x3 matrix) |
|
inlinevirtual |
Default destructor.
|
inline |
Copy Function.
|
inline |
|
inline |
Multiplication by a double vector.
Vec must have the same size as this matrix.
| vec | input vector |
| result | output vector (= M * vec) |
|
inline |
Multiplication by a float vector, outputs a double vector.
Vec must have the same size as this matrix.
| vec | input vector |
| result | output vector (= M * vec) |
|
inline |
Multiplication by a float vector, outputs a float vector.
Vec must have the same size as this matrix.
| vec | input vector |
| result | output vector (= M * vec) |
Referenced by cloudViewer::SquareMatrixTpl< double >::operator*().
|
inline |
Sets all elements to 0.
Referenced by cloudViewer::GeometricalAnalysisTools::ComputeCovarianceMatrix(), ccCompass::estimateStrain(), cloudViewer::SquareMatrixTpl< double >::svd(), and cloudViewer::SquareMatrixTpl< double >::toIdentity().
|
inline |
Returns determinant.
Referenced by cloudViewer::SquareMatrixTpl< double >::deltaDeterminant().
|
inline |
Returns Delta-determinant (see Kramer formula)
|
inline |
Returns a particular matrix value.
Referenced by ccCompass::estimateStrain(), cloudViewer::RegistrationTools::FilterTransformation(), FacetsClassifier::ProcessFamiliy(), cloudViewer::SquareMatrixTpl< double >::SquareMatrixTpl(), and cloudViewer::SquareMatrixTpl< double >::svd().
|
inline |
Creates a rotation matrix from a quaternion (double version)
Quaternion is composed of 4 values: an angle (cos(alpha/2)) and an axis (sin(alpha/2)*unit vector).
| q | normalized quaternion (w,x,y,z) |
|
inline |
Creates a rotation matrix from a quaternion (float version)
Shortcut to double version of initFromQuaternion)
| q | normalized quaternion (4 float values) |
Referenced by GetPoseInformation(), cloudViewer::SquareMatrixTpl< double >::initFromQuaternion(), and cloudViewer::RegistrationTools::RegistrationProcedure().
|
inline |
Returns inverse (Gauss)
|
inline |
Invalidates matrix.
Size is reset to 0.
Referenced by cloudViewer::SquareMatrixTpl< double >::operator=(), cloudViewer::FPCSRegistrationTools::RegisterClouds(), cloudViewer::RegistrationTools::RegistrationProcedure(), and cloudViewer::SquareMatrixTpl< double >::~SquareMatrixTpl().
|
inline |
Returns matrix validity.
Matrix is invalid if its size is 0!
Referenced by ccPointPairRegistrationDlg::align(), ccPointPairRegistrationDlg::apply(), Jacobi< Scalar >::ComputeEigenValuesAndVectors(), Jacobi< Scalar >::ComputeEigenValuesAndVectors2(), cloudViewer::RegistrationTools::FilterTransformation(), FromCCLibMatrix(), Jacobi< Scalar >::GetMaxEigenValueAndVector(), Jacobi< Scalar >::GetMinEigenValueAndVector(), FacetsClassifier::ProcessFamiliy(), cloudViewer::ICPRegistrationTools::Register(), cloudViewer::FPCSRegistrationTools::RegisterClouds(), cloudViewer::RegistrationTools::RegistrationProcedure(), and Jacobi< Scalar >::SortEigenValuesAndVectors().
|
inline |
Multiplication (M = A*B)
|
inline |
Multiplication by a vector.
|
inline |
In-place multiplication.
|
inline |
Addition.
|
inline |
In-place addition.
|
inline |
Subtraction.
|
inline |
In-place subtraction.
|
inline |
Assignment Function.
|
inline |
|
inline |
Matrix copy operator.
|
inline |
Prints out matrix to console or file.
| fp | ASCII FILE handle (or 0 to print to console) |
|
inline |
Returns pointer to matrix row.
Referenced by cloudViewer::GeometricalAnalysisTools::ComputeCrossCovarianceMatrix(), cloudViewer::GeometricalAnalysisTools::ComputeWeightedCrossCovarianceMatrix(), cloudViewer::SquareMatrixTpl< double >::getValue(), and cloudViewer::SquareMatrixTpl< double >::setValue().
|
inline |
Scales matrix (all elements are multiplied by the same coef.)
Referenced by ccPointPairRegistrationDlg::align(), ccPointPairRegistrationDlg::apply(), cloudViewer::GeometricalAnalysisTools::ComputeCrossCovarianceMatrix(), cloudViewer::GeometricalAnalysisTools::ComputeWeightedCrossCovarianceMatrix(), and cloudViewer::RegistrationTools::RegistrationProcedure().
|
inline |
Sets a particular matrix value.
Referenced by ccCompass::estimateStrain(), cloudViewer::RegistrationTools::FilterTransformation(), FacetsClassifier::ProcessFamiliy(), cloudViewer::SquareMatrixTpl< double >::SquareMatrixTpl(), and cloudViewer::SquareMatrixTpl< double >::svd().
|
inline |
Returns matrix size.
Referenced by Jacobi< Scalar >::ComputeEigenValuesAndVectors(), Jacobi< Scalar >::ComputeEigenValuesAndVectors2(), FromCCLibMatrix(), Jacobi< Scalar >::GetEigenVector(), Jacobi< Scalar >::GetMaxEigenValueAndVector(), Jacobi< Scalar >::GetMinEigenValueAndVector(), cloudViewer::SquareMatrixTpl< double >::operator*(), cloudViewer::SquareMatrixTpl< double >::operator+=(), cloudViewer::SquareMatrixTpl< double >::operator-=(), cloudViewer::SquareMatrixTpl< double >::operator=(), Jacobi< Scalar >::SortEigenValuesAndVectors(), and cloudViewer::SquareMatrixTpl< double >::SquareMatrixTpl().
|
inline |
SVD decomposition (inspired from https://github.com/dmalhotra/pvfmm/blob/develop/include/mat_utils.txx)
|
inline |
Referenced by ccGenericPointCloud::computeMeanAndCovariance().
|
inline |
Converts a 3*3 or 4*4 matrix to an OpenGL-style double matrix (double[16])
|
inline |
Converts a 3*3 or 4*4 matrix to an OpenGL-style float matrix (float[16])
Referenced by ccCompass::estimateStrain(), and GetPoseInformation().
|
inline |
Sets matrix to identity.
Referenced by Jacobi< Scalar >::ComputeEigenValuesAndVectors(), Jacobi< Scalar >::ComputeEigenValuesAndVectors2(), ccCompass::estimateStrain(), cloudViewer::RegistrationTools::FilterTransformation(), cloudViewer::RegistrationTools::RegistrationProcedure(), and cloudViewer::SquareMatrixTpl< double >::svd().
|
inline |
Converts rotation matrix to quaternion.
Warning: for 3x3 matrix only! From libE57 'best practices' (http://www.libe57.org/best.html)
| q | quaternion (w,x,y,z) |
Referenced by SavePoseInformation().
|
inline |
Returns trace.
Referenced by cloudViewer::RegistrationTools::RegistrationProcedure(), and cloudViewer::SquareMatrixTpl< double >::trace().
|
inline |
In-place transpose.
Referenced by cloudViewer::SquareMatrixTpl< double >::transposed().
|
inline |
Returns the transposed version of this matrix.
Referenced by ccCompass::estimateStrain(), and cloudViewer::RegistrationTools::RegistrationProcedure().
| Scalar** cloudViewer::SquareMatrixTpl< Scalar >::m_values = nullptr |
The matrix rows.
public for easy/fast access
Referenced by cloudViewer::SquareMatrixTpl< double >::clear(), cloudViewer::GeometricalAnalysisTools::ComputeCovarianceMatrix(), cloudViewer::Neighbourhood::computeCovarianceMatrix(), cloudViewer::SquareMatrixTpl< double >::computeDet(), Jacobi< Scalar >::ComputeEigenValuesAndVectors(), ccCameraSensor::computeOrthoRectificationParams(), cloudViewer::Neighbourhood::computeQuadric(), cloudViewer::SquareMatrixTpl< double >::deltaDeterminant(), ccCompass::estimateStructureNormals(), FromCCLibMatrix(), Jacobi< Scalar >::GetEigenVector(), cloudViewer::SquareMatrixTpl< double >::getValue(), cloudViewer::SquareMatrixTpl< double >::initFromQuaternion(), cloudViewer::SquareMatrixTpl< double >::inv(), cloudViewer::SquareMatrixTpl< double >::invalidate(), cloudViewer::SquareMatrixTpl< double >::operator+=(), cloudViewer::SquareMatrixTpl< double >::operator-=(), cloudViewer::SquareMatrixTpl< double >::operator=(), cloudViewer::SquareMatrixTpl< double >::print(), cloudViewer::RegistrationTools::RegistrationProcedure(), cloudViewer::SquareMatrixTpl< double >::row(), cloudViewer::SquareMatrixTpl< double >::scale(), cloudViewer::SquareMatrixTpl< double >::setValue(), Jacobi< Scalar >::SortEigenValuesAndVectors(), cloudViewer::SquareMatrixTpl< double >::SquareMatrixTpl(), cloudViewer::SquareMatrixTpl< double >::toArray(), cloudViewer::SquareMatrixTpl< double >::toGlMatrix(), cloudViewer::SquareMatrixTpl< double >::toIdentity(), cloudViewer::SquareMatrixTpl< double >::toQuaternion(), cloudViewer::SquareMatrixTpl< double >::trace(), and cloudViewer::SquareMatrixTpl< double >::transpose().