SGTswap

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

Swaps two frames of a Solid



See Also: SGTget , SGTset

Example Illustration

 missing image of SGTswap(SG,FA,FB);

Syntax

SGN=SGTswap(SG,FA,FB);

Input Parameter

SG: Solid
FA: Frame name A
FB: Frame name B

Output Parameter

SGN: Solid with swapped frame names

Examples


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')




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 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.

Input Parameters

Output

Algorithm Steps

  1. Initialize SGN as a copy of SG.
  2. Retrieve the transformation matrix of frame FB using SGTget and store it in TB.
  3. Set the transformation matrix of frame FB in SGN to the transformation matrix of frame FA using SGTset.
  4. Set the transformation matrix of frame FA in SGN to TB using SGTset.
  5. If no output is requested (nargout==0), visualize the original and swapped frames:

Example Usage

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)

Last html export of this page out of FM database by TL: 2025-09-21