how to spread neighbors of a vertex and neighbors of its neighbors based on a criteria Dv ?

1 vue (au cours des 30 derniers jours)
Hello, I am working on a spreading method to spread neighbors of a vertex based on some criteria. I have :
  • a 3D mesh model and a 3D mesh scene,
  • an array IVS of scene vertices that I have already obtained from a matching procedure.
  • an array mindist each element i is the minimum distance between the ith vertex on the the scene and its nearest neighbor on the model stocked in an other array matchs.(I used Knnsearch)
  • the liste of neighbors of each vertex neighboursOfInternal. (I used this code to get them).
so what I want to do is:
for each vertex in IVS
if the distance between this vertex and its nearest neighbor (mindist(vertex)) is less than
a threshold Dv
add all its neighbors from neighboursOfInternal to IVS
repeat this procedure fro all vertices in IVS (vertices and neighbors added).
I tried to code it like this:
neighboursOfInternal = neighboringVertices(vertexS);
tab = IVS;
for i = 1 : length(tab)
disp(i);
if (mindist(IVS(i)) < 2)
tab = [tab cell2mat(neighboursOfInternal(IVS(i)))'];
end
end
with neighboringVertices is a function that returns for each vertex in vertexS all its neighbors connected to it by edges.
the problem I have is that it spreads neignbors just for the vertices in the original array tab (IVS), but the neighbours of neignbors that i added are not taking into acount.
I hope I was clear. I need your help.
  2 commentaires
jiji hr
jiji hr le 27 Juin 2017
I found the solution, I simply had to do it with while loop rather than for, and also to take into account the duplicated vertices while adding neighbors.
Mohsin Shah
Mohsin Shah le 24 Juil 2017
Hello Jihad. Can your code do the job of finding the neighbors of a vertex of a 3D mesh? I need a code which can find the neighbors of all the vertices given the face (connectivity) information. I also need to find the neighbors of neighbors.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by