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
See Also: SGTrotate
B=SGTframerot(B,N,R)
B: | Solid Geometry | |
N: | Frame name | |
R: | Rotation Matrix |
B: | Solid with rotate frame |
SGTframerot(SGbox,'F',rot(0,0,pi/7))
SGTframerot(SGbox,'F',[0,0,pi/7])
SGTframerot(SGbox,'F',pi/7)
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.
R to determine its format and converts it to a transformation matrix T using helper functions:
R is a 3x3 matrix, it is directly converted to a transformation matrix using TofR(R).R is a 1x3 vector, it is first converted to a rotation matrix using rot(R), then to a transformation matrix using TofR.R is a 4x4 matrix, it is assumed to be a transformation matrix and used directly.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.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.nargout==0), the function visualizes the result:
SGfigure(-30,30).SGplotalpha(B,'w',0.5).SGTframeplot(B,N).