by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.2, Creation date: 2022-12-13, Last change: 2025-09-15
See Also: setcamdistance
, setcamtarget
, setcamzoom
setcamdirection(T)
T: | ez or HT matrix; only ez is used |
SGbox; pause(1); setcamdirection([1 1 1]); shg
This function, setcamdirection(T), is designed to set the camera position in a 3D plot without altering the camera target. It is part of the SolidGeometry library and was introduced in version 5.2.
T:
T is a 4x4 matrix, extract the third column's first three elements as ez.T is a character string, convert it to ez using the ezofchar function.T is already the ez vector.cp) and camera target (ct) from the current axes using get(gca, ...).dd) between the camera position and the camera target using the Euclidean norm.ncp) by adding the product of dd and ez to the camera target.ncp using set(gca, 'CameraPosition', ncp).This function allows for the adjustment of the camera's direction in a 3D plot, providing flexibility in visualization without altering the focus point.
Algorithm explaination created using ChatGPT on 2025-08-18 22:53. (Please note: No guarantee for the correctness of this explanation)