Syntax
vi=VLcorrelate(NVL,VL,[thr])
Input Parameter
NVL : | | Long vertex list to search in; must not be unique, first entry is returned |
VL : | | Second vertex list to find in NVL |
thr : | | optional index list to search for |
Output Parameter
Examples
VL1=rounddiv(rand(20,3)*100,5)-50, VL2=rounddiv(rand(20,3)*100,5)-50
VLcorrelate(VL1,ELunsort(VL1))
VLcorrelate([VL1;VL2],ELunsort(VL1))
VLcorrelate([VL1],[ELunsort(VL1);ELunsort(VL2)])
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, VLcorrelate, is designed to find the indices of vertices from a shorter list (VL) within a longer list (NVL). It returns the indices of the first occurrence of each vertex from VL in NVL.
Input Parameters
- NVL: A long vertex list in which to search. The list does not need to be unique, and the function returns the index of the first occurrence of each vertex.
- VL: A second vertex list containing the vertices to find within NVL.
- thr: An optional threshold parameter, which defaults to 1e-15 if not provided. It is used to determine the proximity within which two vertices are considered identical.
Output
- vi: A vector containing the indices in NVL where each vertex from VL is found.
Algorithm Steps
- Initialize the output vector
vi
with NaN values, having the same number of rows as VL.
- Iterate over each vertex in VL:
- Calculate the Euclidean distance between the current vertex in VL and all vertices in NVL using
vecnormr
.
- Find indices where the distance is less than the threshold
thr
.
- If any indices are found, store the first index in the corresponding position in
vi
.
Example Usage
The function can be used to correlate vertices from two lists, as shown in the examples:
VLcorrelate(VL1, ELunsort(VL1))
VLcorrelate([VL1; VL2], ELunsort(VL1))
VLcorrelate([VL1], [ELunsort(VL1); ELunsort(VL2)])
Algorithm explaination created using ChatGPT on 2025-08-19 01:25. (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