Syntax
fi=FLofSGcolor(SG,col)
Input Parameter
SG : | | Solid Geometry |
col : | | search color |
Output Parameter
Examples
SGfittingsample; A=ans; FSofSGT(A,'F',-1); fi=ans; SGcolorfaces(A,'dp',fi); SG=ans, % deep purple
FLofSGcolor(SG,'dp') % logical faces of SG.FL
FLofSGcolor(SG,'r');
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, FLofSGcolor
, is designed to find the facets of a specified color within a solid geometry object. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- SG: This is the Solid Geometry object that contains the vertices and facets of a 3D shape.
- col: This is the color that the function will search for within the facets of the Solid Geometry object.
Output
- fi: This is the index of the facets in the Solid Geometry object that match the specified color.
Algorithm Steps
- The function begins by extracting the vertices list (VL), facets list (FL), and facet colors (FC) from the Solid Geometry object using the helper function
VLFLofSG(SG)
.
- The input color
col
is converted to its RGB representation using the function rgbofall(nofcolmap(col,true))
.
- The function calculates the Euclidean distance between each facet's color in
FC
and the specified color col
. It uses vecnormr(FC-col)
to compute this distance.
- Facets with a color distance less than
1e-2
are considered a match, and their indices are stored in fi
.
- If no output is requested (
nargout==0
), the function will plot the solid geometry. It uses SGfigure
to create a new figure and view(-30,30)
to set the viewing angle.
- The function plots facets that do not match the color in white with 50% transparency using
VLFLplotalpha(VL,FL(~fi,:),'w',0.5)
.
- Facets that match the color are plotted in the specified color using
VLFLplotalpha(VL,FL(fi,:),col)
.
- If no facets match the specified color, a debug message is printed:
dbprintf('Color not found in solid')
.
This function is part of the Solid Geometry library and is used to identify and visualize facets of a specific color within a 3D model.
Algorithm explaination created using ChatGPT on 2025-08-18 23: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