SGTrotate

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 4.0, Creation date: 2017-07-28, Last change: 2025-09-14

returns a solid rotated around a Frame coordinate System



See Also: SGtransT , SGrotate

Example Illustration

 missing image of SGTrotate(SG,N,ax,val)

Syntax

SGN=SGTrotate(SG,[N,ax,val])

Input Parameter

SG: Solid Geoemtry
N: Frame; default is ez; nan means eigenvectors; default is 'B'
ax: rotation axis sequence; 'xyz' or 'x' or 'z'
val: values for rotation; same as ax

Output Parameter

SGN: Spatial rotated Solid includeing the frames




Copyright 2017-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)

The function SGTrotate is designed to rotate a solid geometry (SG) around a specified frame coordinate system. It takes several input parameters and returns a spatially rotated solid, including the frames.

Input Parameters

Output

Algorithm Steps

  1. Initialize default values for N, ax, and val if they are not provided.
  2. Determine the transformation matrix T based on N:
    • If N is a 4x4 matrix, use it directly as T.
    • If N is nan, calculate T using eigenvectors of the solid geometry.
    • Otherwise, retrieve the transformation matrix using SGTget.
  3. Calculate the inverse of T and apply it to the solid geometry using SGtransT.
  4. Initialize a rotation matrix R as the identity matrix.
  5. Iterate over each character in ax to determine the rotation:
    • Case 'x': Apply rotation around the x-axis using rot(val(i),0,0).
    • Case 'y': Apply rotation around the y-axis using rot(0,val(i),0).
    • Case 'z': Apply rotation around the z-axis using rot(0,0,val(i)).
    • Case 'e': Use the eigenvectors of the solid geometry to set R.
    • Otherwise: Throw an error if an invalid axis is specified.
  6. Apply the final transformation to the solid geometry using SGtransT with the combined transformation matrix.
  7. If no output is requested, plot the original and rotated solid geometries for visualization.
Algorithm explaination created using ChatGPT on 2025-08-19 08: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