Syntax
[p,SG,ef,ec]=pofselect3D([obj])
Input Parameter
obj : | | graphics object; default is gca |
Output Parameter
p : | | touched point |
SG : | | touched graphics object |
ef : | | normal vector of facet |
ec : | | normal vector to camera |
Copyright 2020-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)
The function pofselect3D
is designed to interact with 3D graphics objects in a MATLAB environment, specifically for selecting and analyzing touch points on these objects. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- obj: This is the graphics object to be interacted with. If not provided, the default is the current axes (
gca
).
Output Results
- p: The point on the object that was touched or selected.
- SG: The graphics object that was touched.
- ef: The normal vector of the facet at the touched point.
- ec: The normal vector pointing towards the camera.
- fi: Index of the facet that was touched.
- hp: Handle to the graphics object that was touched.
Algorithm Steps
- The function begins by determining the input parameter
obj
using getfuncparams
. If no object is specified, it defaults to the current object (gco
).
- It checks if the object is a Solid Geometry (SG) object using
isSG
. If true, it retrieves the SG object and its transformation matrix, then extracts the position p
and returns.
- If
obj
is a character string, the function exits early.
- The function then calls
select3d
to get the touch point p
, along with other parameters b
, c
, d
, fi
, and hp
.
- It retrieves the SG object associated with the handle
hp
using SGofgo
and SGofSG
.
- The normal vector of the facet
ef
is calculated using VLFLnormf
with the vertex list VL
and facet list FL
of the SG object.
- The camera's transformation matrix
T
is obtained using Tofcam
, and the camera normal vector ec
is derived from it.
- If no output arguments are specified, the function visualizes the normal vectors using
lplot
and enables 3D rotation with rotate3d on
.
Algorithm explaination created using ChatGPT on 2025-08-19 00:08. (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