Syntax
viewsmooth(az,el,[n])
Input Parameter
az : | | azimut similar to view |
el : | | elevantion similar to view |
n : | | number of steps; default is 15 |
Examples
SGfigure(-30,30); SGbox; shg; viewsmooth(170,30,20);
Copyright 2018-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 a MATLAB function named viewsmooth
that smoothly transitions the view of a 3D plot to a new azimuth and elevation over a specified number of steps.
Input Parameters
- az: The target azimuth angle for the view, similar to the azimuth parameter in the
view
function.
- el: The target elevation angle for the view, similar to the elevation parameter in the
view
function.
- n (optional): The number of steps for the transition. If not provided, it defaults to 15.
Algorithm Steps
- The function begins by determining the number of steps
n
using the helper function getfuncparams
. If n
is not provided, it defaults to 15 (calculated as 0.5 * 30
).
- The number of steps
n
is then rounded up to the nearest integer using ceil
.
- The current view angles
a
(azimuth) and e
(elevation) are obtained using the view
function.
- The differences between the target and current angles are calculated as
sa = az - a
and se = el - e
.
- A loop iterates from 0 to
n-1
to gradually change the view:
- In each iteration, the view is updated by incrementally adjusting the azimuth and elevation using the formulas:
a + sa/(n-1)*i
and e + se/(n-1)*i
.
- The
drawnowvid
function is called to update the display after each change.
The function smoothly transitions the view from the current angles to the target angles over the specified number of steps.
Algorithm explaination created using ChatGPT on 2025-08-18 22:52. (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