Syntax
I=getprojectionimage(pc,vdist,vwidth,cupv)
Input Parameter
pc : | | camera position [-x y z] with direction through [0 0 0] |
vdist : | | distance of the screen behind [0 0 0] |
vwidth : | | length of the screen in y and z |
cupv : | | camera up vector; default is [0 -1 0] |
Output Parameter
I : | | Image calculated by getframe and getgcapixelsize |
Copyright 2017-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, getprojectionimage
, is designed to generate a single projection image using a specified camera setup. It is part of the SG-Library and was developed by Tim Lueth.
Input Parameters
- pc: The camera position, specified as a vector [-x y z], with the direction pointing through the origin [0 0 0].
- vdist: The distance from the camera to the screen, which is positioned behind the origin.
- vwidth: The width of the screen in the y and z dimensions.
- cupv: The camera up vector, which defaults to [0 -1 0] if not provided.
Output
- I: The image calculated using the
getframe
and getgcapixelsize
functions.
Algorithm Steps
- Initialize the camera position using the input parameter
pc
. If pc
is not provided, it defaults to the current camera position obtained from gca
.
- Set the camera up vector to
cupv
. If cupv
is not provided, it defaults to [0 -1 0].
- Configure the camera settings:
- Set the camera position using
set(gca, 'CameraPosition', pc)
.
- Set the camera target to the origin [0 0 0] using
set(gca, 'CameraTarget', [0 0 0])
.
- Set the camera up vector using
set(gca, 'CameraUpVector', cupv)
.
- Set the projection type to orthographic using
set(gca, 'Projection', 'orthographic')
.
- Calculate the camera view angle using the formula
vangle = 2 * atan2(vwidth/2, vdist) / pi * 180
and set it using set(gca, 'CameraViewAngle', vangle)
.
- Disable the axis and grid using
axis off
and grid off
.
- Set the lighting and shading to flat using
lighting flat
and shading flat
.
- Capture the frame using
getframe(gcf, getgcapixelsize)
and store it in the output variable I
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:02. (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