Home > vbmeg > functions > brain > vb_next_distance2.m

vb_next_distance2

PURPOSE ^

Search next-point index and distance

SYNOPSIS ^

function [xxD, xxF, xxT]= vb_next_distance2(F,V)

DESCRIPTION ^

 Search next-point index and distance

 next_distanceとの違いは計算後距離に1/1000を掛けること(mm->m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 自分の隣の最近傍点 ( 3角形を共有する点 ) を見つけて
 その番号を xxF へ 距離を xxD へ格納
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 xxF{n} : 頂点 n の 隣接近傍頂点番号
 xxD{n} : 頂点 n と 各隣接近傍点 との 距離
 xxT{n} : 頂点 n の 隣接3角面番号

 Ver 1.0 written by M. Sato  2003-3-15

 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    [xxD, xxF, xxT]= vb_next_distance2(F,V)
0002 % Search next-point index and distance
0003 %
0004 % next_distanceとの違いは計算後距離に1/1000を掛けること(mm->m)
0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0006 % 自分の隣の最近傍点 ( 3角形を共有する点 ) を見つけて
0007 % その番号を xxF へ 距離を xxD へ格納
0008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0009 %
0010 % xxF{n} : 頂点 n の 隣接近傍頂点番号
0011 % xxD{n} : 頂点 n と 各隣接近傍点 との 距離
0012 % xxT{n} : 頂点 n の 隣接3角面番号
0013 %
0014 % Ver 1.0 written by M. Sato  2003-3-15
0015 %
0016 % Copyright (C) 2011, ATR All Rights Reserved.
0017 % License : New BSD License(see VBMEG_LICENSE.txt)
0018 
0019 Npoint = size(V,1);          % number of dipoles
0020 Npatch = size(F,1);          % number of patch
0021 xxF    = cell(Npoint,1); 
0022 xxD    = cell(Npoint,1); 
0023 xxT    = cell(Npoint,1); 
0024 
0025 % 3角面に関するループ
0026 for j=1:Npatch,
0027     % 3角面の頂点インデックス
0028     k = F(j,:); 
0029     
0030     % 各頂点の近傍点リストに他の頂点を加える
0031     xxF{k(1)} = [ xxF{k(1)} ; k(2) ; k(3)];
0032     xxF{k(2)} = [ xxF{k(2)} ; k(3) ; k(1)];
0033     xxF{k(3)} = [ xxF{k(3)} ; k(1) ; k(2)];
0034     
0035     % 各頂点の3角面リストに3角面番号を加える
0036     xxT{k(1)} = [ xxT{k(1)} ; j ];
0037     xxT{k(2)} = [ xxT{k(2)} ; j ];
0038     xxT{k(3)} = [ xxT{k(3)} ; j ];
0039 end;
0040 
0041 for i=1:Npoint,
0042 
0043     % 近傍点リストの重複を除く
0044     nextix = unique(xxF{i});
0045     xxF{i} = nextix;
0046     Nnext  = length(nextix);
0047     
0048     % vector from vertex i to next points xxF{i}
0049     dd       = V(nextix,:) - repmat( V(i,:) , Nnext , 1);
0050     
0051     % Distance from vertex i to next points xxF{i}
0052     xxD{i} = sqrt(dd(:,1).^2+dd(:,2).^2+dd(:,3).^2).*1e-3;
0053 end

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