TS=Tsvd(T)
T : | Original HT Matrix |
TS : | svd corrected T matrix with corrected R=[ex ey yz] |
TofR([pi,pi,pi]), To=ans; Tsvd(To), Tsvd(round(To,13))
This algorithm is designed to orthogonalize a given homogeneous transformation (HT) matrix using Singular Value Decomposition (SVD). It ensures that the rotation part of the matrix is orthogonal and right-handed.
T
. This is the top-left 3x3 submatrix, denoted as R
.R
. This decomposes R
into three matrices: U
, S
, and V
, where R = U * S * V'
.R_ortho
by multiplying U
and the transpose of V
(i.e., R_ortho = U * V'
).R_ortho
is right-handed. This is done by checking the determinant of R_ortho
. If the determinant is negative, adjust the last column of U
by negating it, and then recompute R_ortho
.T
with the orthogonalized matrix R_ortho
.TS
, which is the output of the function.If the function is called without output arguments, it calculates the error as the sum of absolute differences between the original and corrected matrices. It then prints this error and the original vector for debugging purposes.
Algorithm explaination created using ChatGPT on 2025-08-19 00:07. (Please note: No guarantee for the correctness of this explanation)