Computes a scaling vector pc such that, if p=(u,r,s,q) represents affine transformation parameters, where u is a translation, r and q are rotation vectors, and s is the vector of log-scales, then all components of (p/pc) are roughly comparable to the translation component.
To that end, we use a radius parameter which represents the ‘typical size’ of the object being registered. This is used to reformat the parameter vector (translation+rotation+scaling+shearing) so that each element roughly represents a variation in mm.
Inverse operation of rotation_vec2mat.
The algorithm is based on a quaternion representation, exploiting the fact that the rotation vector r = theta*n associated with a quaternion (x,y,z,w) statisfies:
x = sin(theta/2) nx y = sin(theta/2) ny z = sin(theta/2) nz w = cos(theta/2)
1 - 2y^2 - 2z^2 2xy - 2zw 2xz+ 2yw |
- R = | 2xy + 2zw 1 - 2x^2 - 2z^2 2yz - 2xw |
2xz - 2 yw 2yz + 2xw 1 - 2x^2 - 2y^2 |