Syntax
toggleviewprojection
Examples
SGbox
toggleviewprojection
toggleviewprojection
Copyright 2024-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, toggleviewprojection
, is designed to toggle the view projection of a plot in MATLAB between "orthographic" and "perspective". It is part of the SolidGeometry library and was introduced in version 5.4.
Input Parameters
The function does not take any input parameters. It operates on the current axes in the MATLAB figure.
Algorithm Steps
- Retrieve the current projection type of the active axes using
get(gca, 'Projection')
. This returns either 'orthographic' or 'perspective'.
- Check if the current projection is 'orthographic'.
- If it is 'orthographic', change the projection to 'perspective' using
set(gca, 'Projection', 'perspective')
.
- If it is not 'orthographic' (i.e., it is 'perspective'), change the projection to 'orthographic' using
set(gca, 'Projection', 'orthographic')
.
- Check if there are no output arguments expected from the function using
nargout == 0
.
- If no output is expected, print the current projection type to the command window using
dbprintf('projection is now: "%s"', get(gca, 'Projection'))
.
Output
The function does not return any output. It modifies the current axes' projection and optionally prints the new projection type to the command window if no output is expected.
Algorithm explaination created using ChatGPT on 2025-08-18 22:54. (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