diffTrotz
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 5.1, Creation date: 2021-03-15, Last change: 2025-09-15
returns for Frames the relative rotation of the ez vector of B wrt to A
Description
makes no sense for orthogonal vectors. ez should show into the same direction
use atan2 of the x axis
seee also diffanglew afterwards for relative angles
This fucntion is used in TLadjustR
See Also: diffT
, TLadjustR
, diffanglew
, diffTincz
Example Illustration
Syntax
w=diffTrotz(TA,TB)
Input Parameter
Output Parameter
w: | | relative rotation of Bx relative to Ax |
Examples
diffTrotz(eye(4),TofR(rot(0,0,pi/10),[0 0 1]))
Copyright 2021-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, diffTrotz, calculates the relative rotation of the ez vector of frame B with respect to frame A. It is part of the SG-Library and was introduced in SolidGeometry 5.1.
Input Parameters
- TA: Transformation matrix representing frame A.
- TB: Transformation matrix representing frame B.
Output Results
- w: The relative rotation of the x-axis of frame B with respect to the x-axis of frame A.
Algorithm Steps
- Calculate the transformation matrix
TBW by multiplying the inverse of TA with TB:
TBW = TA\TB;
- Compute the relative rotation
w using the atan2 function on the elements of TBW:
w = atan2(TBW(2,1), TBW(1,1));
- Round the result
w to five decimal places:
w = round(w, 5);
- If no output is requested (i.e.,
nargout == 0), perform the following visualization steps:
- Calculate a scaling factor
s using the function sofBB and BBofVL:
s = (sofBB(BBofVL([TA(1:3,4)'; TB(1:3,4)'])) + 1) / 4;
- Create a figure with a specific range using
SGfigure:
SGfigure(-30, 30);
- Plot the frames
TA and TB using tplot with different scaling factors:
tplot(TA, s, '', 'A');
tplot(TB, s * 0.6, '', 'B');
Example
To calculate the relative rotation for a specific transformation, use:
diffTrotz(eye(4), TofR(rot(0, 0, pi/10), [0 0 1]));
Algorithm explaination created using ChatGPT on 2025-08-19 00:02. (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