by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 4.9, Creation date: 2020-07-31, Last change: 2025-09-14
SGN=SGTswap(SG,FA,FB);
SG: | Solid | |
FA: | Frame name A | |
FB: | Frame name B |
SGN: | Solid with swapped frame names |
SG=SGcylinder(10,40); SG=SGTset(SG,'F',TofFS(SG,[0 0 1])); SG=SGTset(SG,'B',TofFS(SG,[0 0 -1]));
SGTswap(SG,'F','B')
This algorithm is designed to swap two frames of a solid object in a 3D space. It is part of the SolidGeometry library and is used for kinematics and frame manipulation.
SGN as a copy of SG.FB using SGTget and store it in TB.FB in SGN to the transformation matrix of frame FA using SGTset.FA in SGN to TB using SGTset.nargout==0), visualize the original and swapped frames:SGfigure.SGtitle.SG with a semi-transparent white color using SGTplotalpha and label it "Original".SGN with a semi-transparent white color using SGTplotalpha and label it with the swapped frame names.The example provided demonstrates creating a cylinder solid, setting two frames, and then swapping them:
SG = SGcylinder(10, 40); SG = SGTset(SG, 'F', TofFS(SG, [0 0 1])); SG = SGTset(SG, 'B', TofFS(SG, [0 0 -1])); SGTswap(SG, 'F', 'B');Algorithm explaination created using ChatGPT on 2025-08-18 23:34. (Please note: No guarantee for the correctness of this explanation)