function  ob = fsphere2(az1,az2,el1,el2,daX,daY,daZ,x0,y0,z0,pr,tp)
% function  ob = fsphere2(az1,az2,el1,el2,daX,daY,daZ,x0,y0,z0,pr,tp)
% az1 = azimut 1
% az2 = azimut 2
% el1 = elévation 1 (bas)
% el2 = elévation 2 (haut)
% daX = demi-axe en x
% daY = demi-axe en y
% daZ = demi-axe en z
% x0 = position en x
% y0 = position en y
% z0 = position en z
% pr = precision (standard=50)
% tp = type (1=surf;2=surfl)

[ph,th]=meshgrid(el1:2*(el2-el1)/pr:el2,az1:(az2-az1)/pr:az2);
x=daX*cos(ph).*cos(th);
y=daY*cos(ph).*sin(th);
z=daZ*sin(ph);

switch tp
case 1
   ob=surf(x+x0,y+y0,z+z0);
case 2
   ob=surfl(x+x0,y+y0,z+z0);
end

%© by Cédric Blaser / 27.11.2001