SGTframerot

by Sophie Lueth & Tim Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 5.0, Creation date: 2020-09-01, Last change: 2025-09-14

returns a frame of a solid



See Also: SGTrotate

Example Illustration

 missing image of SGTframerot(B,N,R)

Syntax

B=SGTframerot(B,N,R)

Input Parameter

B: Solid Geometry
N: Frame name
R: Rotation Matrix

Output Parameter

B: Solid with rotate frame

Examples


SGTframerot(SGbox,'F',rot(0,0,pi/7))
SGTframerot(SGbox,'F',[0,0,pi/7])
SGTframerot(SGbox,'F',pi/7)




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, SGTframerot, is designed to rotate a frame of a solid geometry object. It takes three input parameters and returns a modified solid geometry object.

Input Parameters

Algorithm Steps

  1. The function first checks the size of the input R to determine its format and converts it to a transformation matrix T using helper functions:
    • If R is a 3x3 matrix, it is directly converted to a transformation matrix using TofR(R).
    • If R is a 1x3 vector, it is first converted to a rotation matrix using rot(R), then to a transformation matrix using TofR.
    • If R is a 4x4 matrix, it is assumed to be a transformation matrix and used directly.
    • If R is a single scalar, it is treated as a rotation around the z-axis, converted to a rotation matrix using rot([0 0 R]), and then to a transformation matrix using TofR.
  2. The function updates the frame N of the solid geometry B by multiplying the current transformation matrix of the frame with the new transformation matrix T. This is done using SGTset and SGTget functions.
  3. If no output is requested (i.e., nargout==0), the function visualizes the result:
    • It sets up a figure with a specific view using SGfigure(-30,30).
    • It plots the solid geometry with transparency using SGplotalpha(B,'w',0.5).
    • It plots the frame using SGTframeplot(B,N).
Algorithm explaination created using ChatGPT on 2025-08-18 23:25. (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