Page 1 of 1

Reading the 4X4 T matrix after fine registration

Posted: Tue Jul 21, 2015 4:40 am
by patcarbon
Hi
I need to read the T matrix and be sure of the interpretation. So the format in CC is to have the scaling parameter on the diagonal and the translation vector in the last column. So far so good. Now I know the rotation should be a 'standard' Rij matrix but what confuses me here is that to have R11, R22 and R33 equal to scale you surely have had to transform the whole matrix? And I presume the units are radians?

Any chance I could see the code for the R matrix? Ultimately I need to know the rotation angles as well as the translation vector and scale.

Merci
Patrice

Re: Reading the 4X4 T matrix after fine registration

Posted: Tue Jul 21, 2015 7:17 am
by daniel
Indeed:
A rigid transformation matrix is a composition of a rotation (a 3x3 matrix) and a translation (a 3D vector). For convenience, it can be written as a 4x4 matrix (the rotation matrix corresponds to the upper part of the 3 first columns, the translation vector corresponds to the upper part of the 4th column, and the bottom line is always filled with 3 'zeros' and a 'one').
http://www.cloudcompare.org/doc/wiki/in ... sformation
In case a scale is applied, by convention in CC it is only applied to the rotation (see ccGLMatrix::FromCCLibMatrix):

Code: Select all

P' = s.R.P + T
You can use the 'Apply Transformation' tool to see the equivalent [vector,angle] form of the matrix (simply load/paste your 4x4 matrix in the first tab, then switch to the second tab). And the code that do this conversion is in 'trunk/libs/qCC_db/ccGLMatrixTpl.h'

Code: Select all

ccGLMatrixTpl<T>::getParameters(T alpha_rad, const Vector3Tpl<T>& axis3D, const Vector3Tpl<T>& t3D)