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
- SG: The solid geometry to be rotated.
- N: The frame for rotation. Default is 'B'. If
nan
, eigenvectors are used. If a 4x4 matrix, it is used directly as the transformation matrix.
- ax: The rotation axis sequence. Can be 'xyz', 'x', 'y', 'z', or 'e'.
- val: The values for rotation corresponding to the axes specified in
ax
.
Output
- SGN: The spatially rotated solid geometry, including the frames.
Algorithm Steps
- Initialize default values for
N
, ax
, and val
if they are not provided.
- 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
.
- Calculate the inverse of
T
and apply it to the solid geometry using SGtransT
.
- Initialize a rotation matrix
R
as the identity matrix.
- 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.
- Apply the final transformation to the solid geometry using
SGtransT
with the combined transformation matrix.
- 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