Syntax
setcamtarget([pp])
Input Parameter
pp : | | empty or 3D point or 4x4 HT Matrix |
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, setcamtarget
, is designed to set the camera target in a 3D plot interactively or programmatically. It is part of a visualization library used in AIM lectures.
Input Parameters
- pp: This parameter can be empty, a 3D point, or a 4x4 homogeneous transformation (HT) matrix.
Algorithm Steps
- Retrieve the input parameter
pp
using getfuncparams
. If no parameter is provided, it defaults to an empty value.
- Initialize an empty matrix
T
to store the transformation matrix.
- Check if
pp
is empty:
- If
pp
is empty, the function displays the current figure window using shg
and waits for a mouse click with ginput(1)
.
- After the click, it retrieves the 3D coordinates of the selected point using
select3d
.
- If a point is selected, it sets the camera target to this point using
set(gca,'CameraTarget',pp)
.
- If
pp
is not empty:
- If
pp
is a 3-element vector, it directly sets the camera target to this point.
- If
pp
is a 4x4 matrix, it extracts the translation component (first three elements of the fourth column) and sets it as the camera target.
- Retrieve the current camera target and position using
get(gca,'CameraTarget')
and get(gca,'CameraPosition')
.
- Calculate the vector
ez
from the camera position to the target.
- Compute the transformation matrix
T
using the function TofPez
, which takes pp
and ez
as inputs.
Algorithm explaination created using ChatGPT on 2025-08-19 00:55. (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