TofR

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 2.8, Creation date: 2016-01-06, Last change: 2025-09-14

returns a HT matrix for an R matrix

Description

Supports 2x2 and 3x3 rotation matrices.

See Also: TofR , TofVL , TPL , TofDPhiH , T3ofT2 , Tof3P , T2P , TofP , TofPez , TofPEul , TofT , TofTrel

Example Illustration

 missing image of TofR(R,t,w)

Syntax

T=TofR(R,[t,w])

Input Parameter

R: Rotation matrix 2x3 or 3x3
t: optional translation vector (x y) or [x y z]
w: optional torsion angle at the end

Output Parameter

T: 3x3 or 4x4 transformation matrix

Examples

Try:
TofR(rotdeg(30))
TofR(rotdeg(30,40,30))
TofR(rotdeg(30),[1 2])
TofR(rotdeg(30,40,30),[1 2 3])




Copyright 2016-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, TofR, is designed to generate a homogeneous transformation matrix (HT matrix) from a given rotation matrix and optional translation vector and torsion angle. It is part of the SolidGeometry library and supports both 2D and 3D transformations.

Input Parameters

Output

Algorithm Steps

  1. Check if the input R is already a 4x4 matrix. If so, return it as the transformation matrix T.
  2. If R is a 1x1 or 1x3 vector, convert it to a rotation matrix using the rot function.
  3. Extract the translation vector t and torsion angle w from the optional input parameters using getfuncparams.
  4. If R is a 3x3 matrix, create a 4x4 identity matrix T and set its top-left 3x3 submatrix to R. Set the last column to the translation vector t.
  5. If R is a 2x2 matrix, create a 3x3 identity matrix T and set its top-left 2x2 submatrix to R. Set the last column to the translation vector t.
  6. If the torsion angle w is not zero, multiply the transformation matrix T by the result of TofR(w).
  7. If no output is requested, plot the transformation using SGfigure and plotT functions.
Algorithm explaination created using ChatGPT on 2025-08-19 07:36. (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