Syntax
HT=HTofT(T)
Input Parameter
T : | | transformation matrix (2x2, 3x3, 4x4) |
Output Parameter
HT : | | transformation matrix (4x4) |
Copyright 2013-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
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.
Input Parameters
- T: A transformation matrix that can be of size 2x2, 3x3, or 4x4.
Output Results
- HT: A 4x4 homogeneous transformation matrix.
Algorithm Steps
- Initialize
HT
as a 4x4 identity matrix using eye(4)
.
- Check if
T
is a square matrix by comparing its number of rows and columns.
- If
T
is a square matrix:
- If
T
is 4x4, set HT
to T
.
- If
T
is 3x3, copy the top-left 3x3 submatrix of T
into HT
.
- If
T
is 2x2, copy the top-left 2x2 submatrix of T
into HT
.
- If
T
is none of the above, raise an error indicating an unknown spatial matrix format.
- If
T
is not a square matrix:
- If
T
is a 1xN matrix, set the first N elements of the fourth column of HT
to T
.
- If
T
is an Nx1 matrix, set the first N elements of the fourth column of HT
to T
.
- If
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
.
- If
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
.
- If
T
does not match any of the above conditions, raise an error indicating an unknown format of parameter T
.
Algorithm explaination created using ChatGPT on 2025-08-19 00:19. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21