function  ob = ftube2(daL,daH,lo,x0,y0,z0,or,pr,tp)
% function ob = ftube2(daL,daH,lo,x0,y0,z0,or,pr,tp)
% daL = demi-axe du tube en largeur
% daH = demi-axe du tube en hauteur
% lo = longueur
% x0 = position en x
% y0 = position en y
% z0 = position en z
% or = orientation (1=axe X;2=axe Y;3=axe Z) 
% pr = precision (standard=50)
% tp = type (1=surf;2=surfl)

[x,y] = meshgrid(-daL:2*daL/pr:daL,0:lo/5:lo);
z = daH/daL*sqrt(daL^2-x.^2);
x=[x -x];
y=[y y];
z=[z -z];

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

%© by Cédric Blaser / 27.11.2001