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
- cp: Camera position of the current axes (
gca
).
- cd: Camera direction of the current axes, calculated as a normalized vector pointing from the camera position to the camera target.
- ct: Camera target of the current axes (
gca
).
Algorithm Steps
- The function retrieves the camera target of the current axes using the command
get(gca,'CameraTarget')
and stores it in the variable ct
.
- It retrieves the camera position of the current axes using the command
get(gca,'CameraPosition')
and stores it in the variable cp
.
- 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.
- This vector is then normalized by dividing it by its magnitude, calculated using
norm(ct-cp)
, to ensure it is a unit vector.
- 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