Home > vbmeg > functions > common > boundary > vb_neighbor_index.m

vb_neighbor_index

PURPOSE ^

nearest neighbor index of each vertex

SYNOPSIS ^

function xxF = vb_neighbor_index(V,F)

DESCRIPTION ^

 nearest neighbor index of each vertex
  xxF = vb_neighbor_index(V,F)
 --- Input
 V : vertex of surface
 F : patch index
 --- Output
 xxF{n} : neighboring vertex index of n-th vertex
        = [ 2nd-vertex of j-th patch, 3rd-vertex of j-th patch, j]
          [(# of patch connected to n-th vertex) x 3]
 Ver 1.0  by M. Sato  2004-2-10

 xxF{n} : 頂点 n に隣接する面の頂点番号と面番号

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    xxF = vb_neighbor_index(V,F)
0002 % nearest neighbor index of each vertex
0003 %  xxF = vb_neighbor_index(V,F)
0004 % --- Input
0005 % V : vertex of surface
0006 % F : patch index
0007 % --- Output
0008 % xxF{n} : neighboring vertex index of n-th vertex
0009 %        = [ 2nd-vertex of j-th patch, 3rd-vertex of j-th patch, j]
0010 %          [(# of patch connected to n-th vertex) x 3]
0011 % Ver 1.0  by M. Sato  2004-2-10
0012 %
0013 % xxF{n} : 頂点 n に隣接する面の頂点番号と面番号
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 Npoint = size(V,1);          % 頂点数
0019 Npatch = size(F,1);          % 三角面数
0020 xxF    = cell(Npoint,1);     % 隣接頂点インデックスリスト
0021 
0022 % 3角面に関するループ
0023 for j=1:Npatch,
0024     % 3角面の頂点インデックス
0025     k1 = F(j,1); 
0026     k2 = F(j,2); 
0027     k3 = F(j,3); 
0028     
0029     % 各頂点の隣接点リストに他の頂点と面番号を加える
0030     xxF{k1} = [ xxF{k1} ; k2 , k3 ,j];
0031     xxF{k2} = [ xxF{k2} ; k3 , k1 ,j];
0032     xxF{k3} = [ xxF{k3} ; k1 , k2 ,j];
0033 end;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005