by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 1.1, Creation date: 2013-09-19, Last change: 2025-09-14
HT=HTofT(T)
T: | transformation matrix (2x2, 3x3, 4x4) |
HT: | transformation matrix (4x4) |
This function, HTofT, is designed to convert a given transformation matrix T into a 4x4 homogeneous transformation matrix HT. It is used within the MMplot to facilitate 3D drawings, even when dealing with 2D joint definitions.
HT as a 4x4 identity matrix using eye(4).T is a square matrix by comparing its number of rows and columns.T is a square matrix:
T is 4x4, set HT to T.T is 3x3, copy the top-left 3x3 submatrix of T into HT.T is 2x2, copy the top-left 2x2 submatrix of T into HT.T is none of the above, raise an error indicating an unknown spatial matrix format.T is not a square matrix:
T is a 1xN matrix, set the first N elements of the fourth column of HT to T.T is an Nx1 matrix, set the first N elements of the fourth column of HT to T.T is a 2x3 matrix, copy the top-left 2x2 submatrix of T into HT and set the first two elements of the fourth column of HT to the third column of T.T is a 3x3 matrix, copy the top-left 2x2 submatrix of T into HT and set the first two elements of the fourth column of HT to the third column of T.T does not match any of the above conditions, raise an error indicating an unknown format of parameter T.