필터 지우기
필터 지우기

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
jiji hr
jiji hr 2017년 6월 27일
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 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 CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by