getprojectionimage

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 3.8, Creation date: 2017-04-02, Last change: 2025-09-14

returns a single projection image of gca



See Also: getgcapixelsize , projectionimage

Example Illustration

 missing image of getprojectionimage(pc,vdist,vwidth,cupv)

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

Output

Algorithm Steps

  1. Initialize the camera position using the input parameter pc. If pc is not provided, it defaults to the current camera position obtained from gca.
  2. Set the camera up vector to cupv. If cupv is not provided, it defaults to [0 -1 0].
  3. 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').
  4. Calculate the camera view angle using the formula vangle = 2 * atan2(vwidth/2, vdist) / pi * 180 and set it using set(gca, 'CameraViewAngle', vangle).
  5. Disable the axis and grid using axis off and grid off.
  6. Set the lighting and shading to flat using lighting flat and shading flat.
  7. 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