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.
how to spread neighbors of a vertex and neighbors of its neighbors based on a criteria Dv ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Mohsin Shah
el 24 de Jul. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!