0001 function [X ,NDlist ,Jlist ] = vb_make_sphere_point(Pos)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 theta_step = (Pos.theta_max - Pos.theta_min);
0022 phi_range = (Pos.phi_max - Pos.phi_min)/2;
0023
0024 if theta_step > 0,
0025 theta_step = theta_step/Pos.Ntheta;
0026 end;
0027
0028 Nphi = Pos.Nphi;
0029
0030 theta = theta_step*[0:Pos.Ntheta]+Pos.theta_min;
0031 Ntheta = length(theta);
0032 NDlist = zeros(Ntheta,1);
0033
0034 Phi = [];
0035 Theta = [];
0036 Nstart = 1;
0037 Jlist = cell(Ntheta,1);
0038
0039 for n=1:Ntheta,
0040 DNphi=fix(Nphi*cos(theta(n))/2);
0041
0042 if DNphi> 0,
0043 if DNphi <2,
0044 DNphi=2;
0045 end;
0046 dphi=phi_range/DNphi;
0047 else
0048 dphi=0;
0049 end;
0050
0051 if (phi_range < pi) | ( DNphi == 0 ),
0052 jj = 0:(2*DNphi);
0053 phi = jj*dphi + Pos.phi_min;
0054 NDlist(n) = 2*DNphi+1;
0055 Jlist{n} = jj + Nstart;
0056 Nstart = Nstart + 2*DNphi+1;
0057 else
0058 jj = 0:(2*DNphi-1);
0059 phi = jj*dphi + Pos.phi_min;
0060 NDlist(n) = 2*DNphi;
0061 Jlist{n} = jj + Nstart;
0062 Nstart = Nstart + 2*DNphi;
0063 end;
0064
0065 Phi = [Phi, phi];
0066 Theta = [Theta, theta(n)*ones(1,length(phi)) ];
0067 end;
0068
0069 N=length(Theta);
0070
0071 r = Pos.r;
0072
0073 [x ,y ,z ] = sph2cart(Phi,Theta,r);
0074 [x1,y1,z1] = sph2cart(Phi+0.5*pi, zeros(1,length(Theta)), 1);
0075 [x2,y2,z2] = sph2cart(Phi, Theta+0.5*pi, 1);
0076
0077 X = [x(:),y(:),z(:), x1(:),y1(:),z1(:), x2(:),y2(:),z2(:)];
0078