[T,Tt,va,ax]=Tofgca
T : | HT matrix of camera coordinate system | |
Tt : | HT of target coordinate system | |
va : | current camera angle | |
ax : | current camera axis |
Just try
SGfigure; SGplot(SGsample(1)); pause (1); Tofgca; pause(1); axis tight; view(-30,30)
The function Tofgca
is designed to return the homogeneous transformation (HT) matrix of the current camera position in a MATLAB figure. It is part of the SolidGeometry library and provides information about the camera's orientation and position in the 3D space.
The function does not take any input parameters. It operates on the current axis of the active figure in MATLAB.
get(gca,...)
.ez
by subtracting the camera position from the target and normalizing it.ex
as the cross product of the up vector and ez
, then normalize it.ey
as the cross product of ez
and ex
, then normalize it.T
using ex
, ey
, ez
, and the camera position.ey
.Tt
to T
and modify it to represent the target coordinate system by adjusting the translation and rotation components.ax
.tplot
and SGplot
.If the function is called without output arguments, it visualizes the camera and target in the current figure. It uses the camera's position and target to plot a cone representing the camera's field of view and updates the axis limits accordingly.
Algorithm explaination created using ChatGPT on 2025-08-19 08:18. (Please note: No guarantee for the correctness of this explanation)