gccp

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 1.0, Creation date: 2012-08-11, Last change: 2025-08-18

returns cameraposition, cameradirection and cameratarget

Description

cd=norm(ct-cp);

Example Illustration

 missing image of gccp

Syntax

[cp,cd,ct]=gccp

Output Parameter

cp: camera position of current gca
cd: camera direction of current gca
ct: camera target of current gca




Copyright 2012-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 gccp that retrieves and calculates camera parameters from the current axes in a graphical user interface. The function is part of the SG-Library and was created by Tim Lueth on August 11, 2012. It is classified under visualization functions.

Input Parameters

The function gccp does not take any input parameters. It operates on the current graphical context, specifically the current axes in a MATLAB figure.

Output Results

Algorithm Steps

  1. The function retrieves the camera target of the current axes using the command get(gca,'CameraTarget') and stores it in the variable ct.
  2. It retrieves the camera position of the current axes using the command get(gca,'CameraPosition') and stores it in the variable cp.
  3. The camera direction cd is calculated by subtracting the camera position cp from the camera target ct, resulting in a vector pointing from the camera position to the camera target.
  4. This vector is then normalized by dividing it by its magnitude, calculated using norm(ct-cp), to ensure it is a unit vector.
  5. The function returns the camera position cp, the normalized camera direction cd, and the camera target ct.
Algorithm explaination created using ChatGPT on 2025-08-18 21:48. (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