setcamangle

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.2, Creation date: 2022-12-16, Last change: 2025-09-15

set the camera angle is set

Description

This function belongs to a set of function useful for AIM lectures

See Also: setcamzoom , setcamdistance , setcamtarget , setcamdirection

Example Illustration

 missing image of setcamangle(na,nd)

Syntax

setcamangle([na,nd])

Input Parameter

na: empty or 3D point or 4x4 HT Matrix
nd:

Examples


load AIM.mat; VM=V; [AM,as]=VMresize(VM,[0.5 0.5 0.5],vs); AM(:,230:256,:)=0;
SG=SGofVMisosurface(AM>1400,as);
SGfigure; SGplotalpha(SG,'w',0.5); rotate3dlight('off')
view(-30,30); setcamtarget




Copyright 2022-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, setcamangle, is designed to set the camera angle in a 3D visualization environment. It is part of a library used for AIM lectures and was introduced in SolidGeometry 5.2.

Input Parameters

Algorithm Steps

  1. Retrieve the input parameters na and nd using the getfuncparams function.
  2. Set the camera modes to "manual" for position, target, and view angle using set(gca,...).
  3. Get the current camera properties: position (cp), target (ct), view angle (ca), and up vector (cu).
  4. Calculate the eye-to-center vector (ec) and its distance (dc).
  5. Initialize the zoom factor (zz) to 1. If nd is not empty, adjust zz to nd/dc.
  6. Use shg to bring the current figure window to the front.
  7. If na is not empty, adjust the camera position and view angle:
    • Calculate the scaling factor k as ca/na.
    • Set the new camera position using ct + k * ec * zz.
    • Adjust the camera view angle to ca/k.
    • Update the camera properties: position (cp), view angle (ca), eye-to-center vector (ec), and distance (dc).
  8. If there are no output arguments, print the camera distance and angle using dbprintf.
Algorithm explaination created using ChatGPT on 2025-08-19 08:00. (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