toggleviewprojection

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.4, Creation date: 2024-05-22, Last change: 2025-08-18

toggle view projection between "orthographic" and "perspective"

Description

During design of technical components the orthographic makes more sense for view(0,0), view(0,90) etc.

See Also: app_2012_11_09

Example Illustration

 missing image of toggleviewprojection

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

  1. Retrieve the current projection type of the active axes using get(gca, 'Projection'). This returns either 'orthographic' or 'perspective'.
  2. Check if the current projection is 'orthographic'.
  3. If it is 'orthographic', change the projection to 'perspective' using set(gca, 'Projection', 'perspective').
  4. If it is not 'orthographic' (i.e., it is 'perspective'), change the projection to 'orthographic' using set(gca, 'Projection', 'orthographic').
  5. Check if there are no output arguments expected from the function using nargout == 0.
  6. 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