Syntax
vi=SGisOnsurface(SG,VL);
Input Parameter
SG : | | Solid Geometry |
VL : | | Vertex list to test |
Output Parameter
vi : | | On Surface Index of VL |
Examples
A=SGbool('-',SGbox([30,20,10]),SGbox([26,16,6]));
SGisOnsurface(A,0.5*(A.VL+circshift(A.VL,1)))
isonVLFL(A.VL,A.FL,0.5*(A.VL+circshift(A.VL,3)))
isonVLFL(A.VL,A.FL,0.5*(A.VL+circshift(A.VL,3)))
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)
This function, SGisOnsurface
, determines whether points in a vertex list (VL) are on the surface of a given solid geometry (SG).
Input Parameters
- SG: Represents the solid geometry. It is expected to be a structure containing at least vertex list (VL) and face list (FL).
- VL: A list of vertices to be tested against the surface of the solid geometry.
Output
- vi: A logical index array indicating which vertices in VL are on the surface of the solid geometry.
Algorithm Steps
- The function begins by ensuring that the input
SG
is in the correct format using SGofSG(SG)
. This likely standardizes or validates the solid geometry structure.
- The core operation is performed by calling
isonVLFL(SG.VL, SG.FL, VL)
. This function checks which vertices in VL
are on the surface defined by the vertex list SG.VL
and face list SG.FL
. The result is stored in vi
.
- If no output is requested (i.e.,
nargout == 0
), the function proceeds to visualize the results:
- It creates a figure and sets the view to a 3D perspective using
view(-30,30)
.
- The solid geometry is plotted with a semi-transparent white color using
SGplotalpha(SG, 'w', 0.2)
.
- If no output is requested again, it creates another figure with a top-down view using
view(0,90)
:
- The surface of the solid geometry is plotted using
VLFLplotalpha(SG.VL, SG.FL, 'w', 0.2)
.
- Vertices on the surface are plotted in green using
VLplot(VL(vi,:), 'g.', 1)
.
- Vertices not on the surface are plotted in red using
VLplot(VL(~vi,:), 'r.', 1)
.
Example Usage
An example is provided where a boolean operation is performed on two boxes, and the resulting geometry is tested to find which vertices are on the surface.
Algorithm explaination created using ChatGPT on 2025-08-19 00:34. (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