selectNaN
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.6, Creation date: 2017-03-11, Last change: 2025-09-14
connects subsets of closed polygons lines (2D/3D) wrt an index list
See Also: lengthNaN
, replaceNaN
, cellofNaN
, separateNaN
, uniqueNaN
, unsortNaN
Example Illustration
Syntax
CPLN=selectNaN(CPL,ci)
Input Parameter
CPL: | | CPL / CVL |
ci: | | index list [ |
Output Parameter
CPLN: | | Subset of CPL or new ordered CPL |
Examples
Select 3 CPL of CPLsample(14)
selectNaN(VLaddz(CPLsample(14),pi),[1,3,6])
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, selectNaN, is designed to select and reorder subsets of closed polygon lines (CPL) based on a given index list. It is part of the SolidGeometry library.
Input Parameters
- CPL: A matrix representing closed polygon lines or closed vector lines.
- ci: An index list specifying which subsets of CPL to select.
Output
- CPLN: A subset of CPL or a newly ordered CPL based on the index list.
Algorithm Steps
- Check if the index list
ci is empty. If it is, return an empty matrix for CPLN.
- If
ci is a column vector, transpose it to a row vector.
- Initialize
CPLN as a matrix of NaNs with the same size as CPL.
- If
ci contains only one index, use the separateNaN function to extract the corresponding subset from CPL.
- If
ci contains multiple indices, iterate over each index in ci:
- Use
separateNaN to extract the subset of CPL for the current index.
- Determine the number of rows in the extracted subset.
- Insert the extracted subset into
CPLN at the appropriate position.
- Update the position index
k for the next insertion.
- Trim
CPLN to remove any trailing NaN rows.
- If no output argument is specified, plot the original and selected CPLs:
- Set up a figure with a top-down view and grid.
- Plot the original CPL in green and the selected CPL in red.
Algorithm explaination created using ChatGPT on 2025-08-19 01: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