diffT
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 5.0, Creation date: 2020-12-30, Last change: 2025-09-15
returns the difference between 2 4x4 HT matrices
Description
dp returns the distance of the origins
dz returns the distance angle of the ez vectors
dy returns the distance angle of the ey vectors (w2 - w1)
wz returns the straight line distance angle of ez
wy returns the straight line distance angle of ey
See Also: diffanglew
, diffangle
, isequalT
, uniqueT
Example Illustration
Syntax
delta=diffT(TA,TB)
Input Parameter
TA: | | HT Matrix A |
TB: | | HT Matrix B |
Output Parameter
Examples
diffT(eye(4),TofR(rot(0,0,pi/10),[0 0 1]))
diffT(eye(4),TofPez([0 0 1],[0 1 0],-pi/2))
Copyright 2020-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, diffT, calculates the difference between two 4x4 homogeneous transformation matrices, TA and TB. It returns a vector, delta, containing five elements: dp, dz, dy, wz, and wy.
Input Parameters
- TA: A 4x4 homogeneous transformation matrix representing the first transformation.
- TB: A 4x4 homogeneous transformation matrix representing the second transformation.
Output Results
- delta: A vector [dp, dz, dy, wz, wy] where:
- dp: The Euclidean distance between the origins of TA and TB.
- dz: The angular difference between the z-axes (ez vectors) of TA and TB.
- dy: The angular difference between the y-axes (ey vectors) of TA and TB.
- wz: The straight-line distance angle of the z-axes.
- wy: The straight-line distance angle of the y-axes.
Algorithm Steps
- Calculate dp as the Euclidean distance between the translation components of TA and TB:
dp = norm(TA(1:3,4) - TB(1:3,4)).
- Calculate dz as the angular difference between the z-axes of TA and TB using the
diffangle function: dz = diffangle(TA(1:3,3)', TB(1:3,3)').
- Calculate dy as the angular difference between the y-axes of TA and TB using the
diffangle function: dy = diffangle(TA(1:3,2)', TB(1:3,2)').
- Calculate wz as the straight-line distance angle of the z-axes:
wz = pi/2 - abs(abs(dz) - pi/2).
- Calculate wy as the straight-line distance angle of the y-axes:
wy = pi/2 - abs(abs(dy) - pi/2).
- Combine the results into the delta vector:
delta = [dp, dz, dy, wz, wy].
- Round the elements of delta to five decimal places:
delta = round(delta, 5).
- If no output is requested, visualize the transformations using
SGfigure and tplot functions.
Algorithm explaination created using ChatGPT on 2025-08-19 07:45. (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