Syntax
fil=VLFLfaceneighborhood(VL,FL,fi,n)
Input Parameter
VL : | | Vertex list |
FL : | | Facet list |
fi : | | face index |
n : | | shells of neighbors |
Output Parameter
fil : | | cell list of neighborhood |
Examples
load JACO_robot.mat % or loadweb
VLFLfaceneighborhood(JC1.VL,JC1.FL,11181,10)
VLFLfaceneighborhood(SGsphere(1),'',100,2)
Copyright 2021-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, VLFLfaceneighborhood
, is designed to find the neighboring faces of a given face in a 3D mesh, and it can also find neighbors of neighbors up to a specified number of shells.
Input Parameters
- VL: Vertex list, a matrix where each row represents the coordinates of a vertex in the 3D space.
- FL: Facet list, a matrix where each row represents a face by indexing into the vertex list.
- fi: Face index, an integer specifying the face for which neighbors are to be found.
- n: Number of shells, an integer specifying how many layers of neighboring faces to find.
Output
- fil: A cell array where each cell contains a list of face indices representing the neighbors at each shell level.
Algorithm Steps
- Check if
VL
is a special geometry object using isSG
. If true, extract FL
and VL
from it.
- Initialize
fil
as a cell array with n
cells.
- Store the initial face index
fi
in fis
.
- Create a
triangulation
object TR
using FL
and VL
.
- For each shell from 1 to
n
:
- Find the neighbors of the current face using
neighbors(TR,fi)
.
- Remove the current face index from the list of neighbors using
setdiff
.
- Update
fi
to include the new neighbors.
- Store the unique neighbors in
fil
for the current shell.
- If no output is requested (
nargout==0
), visualize the mesh:
- Plot the non-neighboring faces in white.
- Plot the initial face in green.
- Iterate over each shell and plot the neighbors in different colors.
- Adjust the camera view and zoom to focus on the neighborhood.
Algorithm explaination created using ChatGPT on 2025-08-19 01:21. (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