--- reduce connection vertex [V, id] = reduce_connection(d, p); --- path coordinate for n-th connection d.Vc{n} : vertex coordinates along n-th connection path --- pair of vetex index for n-th connection d.I_from(n) : start vertex index d.I_to(n) : end vertex index --- skip parameter p.Nskip = skip number for connections selection p.Nstep = skip number along path (neighbor distance= Nstep*0.2mm) --- output: reduced connection vertex V{n} : vertex 3D coordinate for n-th connections [Np x 3] id.I_from(n) : start vertex index for n-th connection id.I_to(n) : end vertex index for n-th connection 2014-11-10 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [V, id] = reduce_connection(d, p); 0002 % --- reduce connection vertex 0003 % [V, id] = reduce_connection(d, p); 0004 % --- path coordinate for n-th connection 0005 % d.Vc{n} : vertex coordinates along n-th connection path 0006 % --- pair of vetex index for n-th connection 0007 % d.I_from(n) : start vertex index 0008 % d.I_to(n) : end vertex index 0009 % --- skip parameter 0010 % p.Nskip = skip number for connections selection 0011 % p.Nstep = skip number along path (neighbor distance= Nstep*0.2mm) 0012 % --- output: reduced connection vertex 0013 % V{n} : vertex 3D coordinate for n-th connections [Np x 3] 0014 % id.I_from(n) : start vertex index for n-th connection 0015 % id.I_to(n) : end vertex index for n-th connection 0016 % 0017 % 2014-11-10 Masa-aki Sato 0018 % 0019 % Copyright (C) 2011, ATR All Rights Reserved. 0020 % License : New BSD License(see VBMEG_LICENSE.txt) 0021 0022 0023 % number of connections 0024 NC = length(d.Vc); 0025 0026 % skip selection for connections 0027 nlist = 1:p.Nskip:NC; 0028 0029 % --- pair of vetex index for n-th connection 0030 id.I_from = d.I_from(nlist); 0031 id.I_to = d.I_to(nlist) ; 0032 0033 N = length(nlist); 0034 V = cell(N,1); 0035 0036 for n=1:N 0037 NP = size(d.Vc{nlist(n)},1); 0038 0039 if p.Nstep < NP 0040 % skip points along path 0041 V{n} = d.Vc{nlist(n)}(1:p.Nstep:NP,:); 0042 0043 if mod(NP,p.Nstep)~=0 0044 V{n} = [V{n}; d.Vc{nlist(n)}(end,:)]; 0045 end 0046 else 0047 V{n} = d.Vc{nlist(n)}([1,NP],:); 0048 end 0049 if size(V{n},1) < 2, 0050 fprintf('# of point=%d\n',size(V{n},1)) 0051 end 0052 end