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

vb_combine_surf

PURPOSE ^

combine multiple surfaces

SYNOPSIS ^

function [F, V, xx] = vb_combine_surf(Fall, Vall, ix_select)

DESCRIPTION ^

 combine multiple surfaces
  [F, V, xx] = vb_combine_surf(Fall, Vall, ix_select)
 --- Input
 Vall{n} : vertex of n-th connected surface
 Fall{n} : patch index
 ix_select : number of surface to be selected
 --- Output
 V  : vertex of combined surface
 F  : patch index
 xx : outward normal vector of combined surface

 Ver 1.0  by M. Sato  2006-6-4

 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    [F, V, xx] = vb_combine_surf(Fall, Vall, ix_select)
0002 % combine multiple surfaces
0003 %  [F, V, xx] = vb_combine_surf(Fall, Vall, ix_select)
0004 % --- Input
0005 % Vall{n} : vertex of n-th connected surface
0006 % Fall{n} : patch index
0007 % ix_select : number of surface to be selected
0008 % --- Output
0009 % V  : vertex of combined surface
0010 % F  : patch index
0011 % xx : outward normal vector of combined surface
0012 %
0013 % Ver 1.0  by M. Sato  2006-6-4
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 N  = length(ix_select);
0019 NV = zeros(N,1);
0020 NF = zeros(N,1);
0021 
0022 for n = 1:N
0023     j  = ix_select(n);
0024     NV(n) = size(Vall{j},1);
0025     NF(n) = size(Fall{j},1);
0026 end
0027 
0028 V  = zeros(sum(NV),3);
0029 F  = zeros(sum(NF),3);
0030 xx = zeros(sum(NV),3);
0031 
0032 Nvertex = 0;
0033 Npatch  = 0;
0034 
0035 for n = 1:N
0036     j  = ix_select(n);
0037     n1 = Nvertex + 1;
0038     n2 = Nvertex + NV(n);
0039     
0040     V(n1:n2,:) = Vall{j};
0041 
0042     % normal vector
0043     [xxn ,FF] = vb_out_normal_vect(Vall{j}, Fall{j});
0044 
0045     xx(n1:n2,:) = xxn;
0046 
0047     m1 = Npatch + 1;
0048     m2 = Npatch + NF(n);
0049     
0050     F(m1:m2,:) = FF + Nvertex;
0051 
0052     Nvertex = Nvertex + NV(n);
0053     Npatch  = Npatch  + NF(n);
0054 end

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