Syntax
SGfigtrans0([cax])
Input Parameter
Examples
SGjacohand, axis on
SGfigtrans0
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 function, SGfigtrans0
, is designed to move all graphical elements within the current axis into the first octant. It is part of the SolidGeometry library and was introduced in version 5.0.
Input Parameters
- cax: The current axis handle. If not provided, it defaults to
gca
(get current axis).
Algorithm Steps
- Retrieve the current axis using
getfuncparams
, which checks if an axis handle is provided in the input arguments. If not, it defaults to gca
.
- Obtain the SolidGeometry (SG) object associated with the current axis using
SGofgca
.
- Calculate the bounding box of the SG object using
BBofSG
. This returns a vector bb
containing the minimum and maximum coordinates in each dimension.
- Determine the offset required to move the SG object into the first octant. This offset is the negative of the minimum coordinates in each dimension, stored in the vector
offset
.
- Find all graphical objects of type 'patch' within the current axis using
findobj
. For each patch object, adjust its vertices by subtracting the offset
vector.
- Find all graphical objects of type 'Text' within the current axis. For each text object, adjust its position by subtracting the
offset
vector.
- Find all graphical objects of type 'Line' within the current axis. For each line object, adjust its
XData
, YData
, and ZData
by subtracting the corresponding components of the offset
vector.
- Optionally, the function can update the display with
drawnow
and set the view to a top-down perspective with view(0,90)
. However, these lines are commented out.
- Finally, the axis is set to 'tight' to fit the adjusted graphical elements.
Algorithm explaination created using ChatGPT on 2025-08-18 23:33. (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