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 (최근 30일)
이전 댓글 표시
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
Mohsin Shah
2017년 7월 24일
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!