![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#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]')
Definition at line 25 of file SquareMatrix.h.
|
inline |
Default constructor.
Warning: invalid matrix.
Definition at line 30 of file SquareMatrix.h.
Referenced by cloudViewer::SquareMatrixTpl< Scalar >::inv().
|
inline |
Constructor with a given size.
| size | the (square) matrix dimension |
Definition at line 35 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inline |
Constructor from another double matrix.
| mat | matrix |
Definition at line 40 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::getValue(), cloudViewer::SquareMatrixTpl< Scalar >::setValue(), and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inline |
Constructor from another float matrix.
| mat | matrix |
Definition at line 51 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::getValue(), cloudViewer::SquareMatrixTpl< Scalar >::setValue(), and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
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) |
Definition at line 66 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
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) |
Definition at line 83 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inlinevirtual |
Default destructor.
Definition at line 94 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::invalidate().
|
inline |
Copy Function.
Definition at line 97 of file SquareMatrix.h.
|
inline |
Definition at line 100 of file SquareMatrix.h.
|
inline |
Multiplication by a double vector.
Vec must have the same size as this matrix.
| vec | input vector |
| result | output vector (= M * vec) |
Definition at line 294 of file SquareMatrix.h.
|
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) |
Definition at line 280 of file SquareMatrix.h.
|
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) |
Definition at line 266 of file SquareMatrix.h.
Referenced by cloudViewer::SquareMatrixTpl< Scalar >::operator*().
|
inline |
Sets all elements to 0.
Definition at line 319 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by cloudViewer::GeometricalAnalysisTools::ComputeCovarianceMatrix(), ccCompass::estimateStrain(), cloudViewer::SquareMatrixTpl< Scalar >::svd(), and cloudViewer::SquareMatrixTpl< Scalar >::toIdentity().
|
inline |
Returns determinant.
Definition at line 474 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by cloudViewer::SquareMatrixTpl< Scalar >::deltaDeterminant().
|
inline |
Returns Delta-determinant (see Kramer formula)
Definition at line 582 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::computeDet(), and cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Returns a particular matrix value.
Definition at line 168 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::row().
Referenced by ccCompass::estimateStrain(), cloudViewer::RegistrationTools::FilterTransformation(), FacetsClassifier::ProcessFamiliy(), cloudViewer::SquareMatrixTpl< Scalar >::SquareMatrixTpl(), and cloudViewer::SquareMatrixTpl< Scalar >::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) |
Definition at line 492 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Creates a rotation matrix from a quaternion (float version)
Shortcut to double version of initFromQuaternion)
| q | normalized quaternion (4 float values) |
Definition at line 480 of file SquareMatrix.h.
Referenced by GetPoseInformation(), and cloudViewer::RegistrationTools::RegistrationProcedure().
|
inline |
Returns inverse (Gauss)
Definition at line 326 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, result, cloudViewer::SquareMatrixTpl< Scalar >::SquareMatrixTpl(), and std::swap().
|
inline |
Invalidates matrix.
Size is reset to 0.
Definition at line 143 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by cloudViewer::SquareMatrixTpl< Scalar >::operator=(), cloudViewer::FPCSRegistrationTools::RegisterClouds(), cloudViewer::RegistrationTools::RegistrationProcedure(), and cloudViewer::SquareMatrixTpl< Scalar >::~SquareMatrixTpl().
|
inline |
Returns matrix validity.
Matrix is invalid if its size is 0!
Definition at line 138 of file SquareMatrix.h.
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)
Definition at line 225 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inline |
Multiplication by a vector.
Definition at line 243 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::apply(), result, and Tuple3Tpl< Type >::u.
|
inline |
In-place multiplication.
Definition at line 255 of file SquareMatrix.h.
|
inline |
Addition.
Definition at line 187 of file SquareMatrix.h.
|
inline |
In-place addition.
Definition at line 195 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inline |
Subtraction.
Definition at line 206 of file SquareMatrix.h.
|
inline |
In-place subtraction.
Definition at line 214 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inline |
Assignment Function.
Definition at line 105 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Definition at line 114 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Matrix copy operator.
Definition at line 173 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::invalidate(), cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::size().
|
inline |
Prints out matrix to console or file.
| fp | ASCII FILE handle (or 0 to print to console) |
Definition at line 435 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Returns pointer to matrix row.
Definition at line 160 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by cloudViewer::GeometricalAnalysisTools::ComputeCrossCovarianceMatrix(), cloudViewer::GeometricalAnalysisTools::ComputeWeightedCrossCovarianceMatrix(), cloudViewer::SquareMatrixTpl< Scalar >::getValue(), and cloudViewer::SquareMatrixTpl< Scalar >::setValue().
|
inline |
Scales matrix (all elements are multiplied by the same coef.)
Definition at line 459 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by ccPointPairRegistrationDlg::align(), ccPointPairRegistrationDlg::apply(), cloudViewer::GeometricalAnalysisTools::ComputeCrossCovarianceMatrix(), cloudViewer::GeometricalAnalysisTools::ComputeWeightedCrossCovarianceMatrix(), and cloudViewer::RegistrationTools::RegistrationProcedure().
|
inline |
Sets a particular matrix value.
Definition at line 163 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and cloudViewer::SquareMatrixTpl< Scalar >::row().
Referenced by ccCompass::estimateStrain(), cloudViewer::RegistrationTools::FilterTransformation(), FacetsClassifier::ProcessFamiliy(), cloudViewer::SquareMatrixTpl< Scalar >::SquareMatrixTpl(), and cloudViewer::SquareMatrixTpl< Scalar >::svd().
|
inline |
Returns matrix size.
Definition at line 133 of file SquareMatrix.h.
Referenced by Jacobi< Scalar >::ComputeEigenValuesAndVectors(), Jacobi< Scalar >::ComputeEigenValuesAndVectors2(), FromCCLibMatrix(), Jacobi< Scalar >::GetEigenVector(), Jacobi< Scalar >::GetMaxEigenValueAndVector(), Jacobi< Scalar >::GetMinEigenValueAndVector(), cloudViewer::SquareMatrixTpl< Scalar >::operator*(), cloudViewer::SquareMatrixTpl< Scalar >::operator+=(), cloudViewer::SquareMatrixTpl< Scalar >::operator-=(), cloudViewer::SquareMatrixTpl< Scalar >::operator=(), Jacobi< Scalar >::SortEigenValuesAndVectors(), and cloudViewer::SquareMatrixTpl< Scalar >::SquareMatrixTpl().
|
inline |
SVD decomposition (inspired from https://github.com/dmalhotra/pvfmm/blob/develop/include/mat_utils.txx)
Definition at line 640 of file SquareMatrix.h.
References abs(), cloudViewer::SquareMatrixTpl< Scalar >::clear(), cloudViewer::SquareMatrixTpl< Scalar >::getValue(), cloudViewer::SquareMatrixTpl< Scalar >::setValue(), std::swap(), and cloudViewer::SquareMatrixTpl< Scalar >::toIdentity().
|
inline |
Definition at line 123 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Converts a 3*3 or 4*4 matrix to an OpenGL-style double matrix (double[16])
Definition at line 620 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
|
inline |
Converts a 3*3 or 4*4 matrix to an OpenGL-style float matrix (float[16])
Definition at line 601 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by ccCompass::estimateStrain(), and GetPoseInformation().
|
inline |
Sets matrix to identity.
Definition at line 452 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::clear(), and cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by Jacobi< Scalar >::ComputeEigenValuesAndVectors(), Jacobi< Scalar >::ComputeEigenValuesAndVectors2(), ccCompass::estimateStrain(), cloudViewer::RegistrationTools::FilterTransformation(), cloudViewer::RegistrationTools::RegistrationProcedure(), and cloudViewer::SquareMatrixTpl< Scalar >::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) |
Definition at line 525 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by SavePoseInformation().
|
inline |
Returns trace.
Definition at line 465 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values.
Referenced by cloudViewer::RegistrationTools::RegistrationProcedure().
|
inline |
In-place transpose.
Definition at line 304 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::m_values, and std::swap().
Referenced by cloudViewer::SquareMatrixTpl< Scalar >::transposed().
|
inline |
Returns the transposed version of this matrix.
Definition at line 311 of file SquareMatrix.h.
References cloudViewer::SquareMatrixTpl< Scalar >::transpose().
Referenced by ccCompass::estimateStrain(), and cloudViewer::RegistrationTools::RegistrationProcedure().
| Scalar** cloudViewer::SquareMatrixTpl< Scalar >::m_values = nullptr |
The matrix rows.
public for easy/fast access
Definition at line 157 of file SquareMatrix.h.
Referenced by cloudViewer::SquareMatrixTpl< Scalar >::clear(), cloudViewer::Neighbourhood::computeCovarianceMatrix(), cloudViewer::GeometricalAnalysisTools::ComputeCovarianceMatrix(), cloudViewer::SquareMatrixTpl< Scalar >::computeDet(), Jacobi< Scalar >::ComputeEigenValuesAndVectors(), Jacobi< Scalar >::ComputeEigenValuesAndVectors2(), cloudViewer::Neighbourhood::computeQuadric(), cloudViewer::SquareMatrixTpl< Scalar >::deltaDeterminant(), ccCompass::estimateStructureNormals(), FromCCLibMatrix(), Jacobi< Scalar >::GetEigenVector(), cloudViewer::SquareMatrixTpl< Scalar >::getValue(), cloudViewer::SquareMatrixTpl< Scalar >::initFromQuaternion(), cloudViewer::SquareMatrixTpl< Scalar >::inv(), cloudViewer::SquareMatrixTpl< Scalar >::invalidate(), cloudViewer::SquareMatrixTpl< Scalar >::operator+=(), cloudViewer::SquareMatrixTpl< Scalar >::operator-=(), cloudViewer::SquareMatrixTpl< Scalar >::operator=(), cloudViewer::SquareMatrixTpl< Scalar >::print(), cloudViewer::RegistrationTools::RegistrationProcedure(), cloudViewer::SquareMatrixTpl< Scalar >::row(), cloudViewer::SquareMatrixTpl< Scalar >::scale(), cloudViewer::SquareMatrixTpl< Scalar >::setValue(), Jacobi< Scalar >::SortEigenValuesAndVectors(), cloudViewer::SquareMatrixTpl< Scalar >::SquareMatrixTpl(), cloudViewer::SquareMatrixTpl< Scalar >::toArray(), cloudViewer::SquareMatrixTpl< Scalar >::toGlMatrix(), cloudViewer::SquareMatrixTpl< Scalar >::toIdentity(), cloudViewer::SquareMatrixTpl< Scalar >::toQuaternion(), cloudViewer::SquareMatrixTpl< Scalar >::trace(), and cloudViewer::SquareMatrixTpl< Scalar >::transpose().