Home > vbmeg > functions > leadfield > sphere > vb_calc_sphere_point_num.m

vb_calc_sphere_point_num

PURPOSE ^

球面上の点数が Nsphere に近い分割を求める

SYNOPSIS ^

function [Ntheta, Nphi, Nall ] = vb_calc_sphere_point_num(Nsphere)

DESCRIPTION ^

 球面上の点数が Nsphere に近い分割を求める
 

 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 [Ntheta, Nphi, Nall ] = vb_calc_sphere_point_num(Nsphere)
0002 % 球面上の点数が Nsphere に近い分割を求める
0003 %
0004 %
0005 % Copyright (C) 2011, ATR All Rights Reserved.
0006 % License : New BSD License(see VBMEG_LICENSE.txt)
0007 theta_min  = -0.5*pi;
0008 
0009 mode  = 1;
0010 resol = sqrt(6*pi/(Nsphere));
0011 Nmax  = 2*fix(pi/(2*resol));
0012 
0013 Ltheta = 2*[1:Nmax];
0014 Lphi =  zeros(Nmax,1);
0015 Lall =  zeros(Nmax,1);
0016 
0017 for n = 3:Nmax
0018     Ntheta=2*n;
0019     % angle step size
0020     step = pi/Ntheta;
0021     % Max # of phi devision
0022     Nphi = fix(2*pi/step);
0023     
0024     theta = step*[1:Ntheta-1] + theta_min;
0025     % Total # of points
0026     Nall  = sum( 2*fix( Nphi*cos(theta)/2 ) ) + 2;
0027     
0028     Lphi(n)=Nphi;
0029     Lall(n)=Nall;
0030     
0031     if Nall > Nsphere, break; end;
0032     
0033 end
0034 
0035 if mode == 0
0036     [dmin,ix] = min(abs( Lall - Nsphere ));
0037 else
0038     ix = n;
0039 end
0040 
0041 Nall   = Lall(ix);
0042 Ntheta = Ltheta(ix);
0043 Nphi   = Lphi(ix);

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