Create a 3D mesh representing a cylinder.

   [V, F] = cylinderMesh(CYL)
   Computes vertex coordinates and face vertex indices of a mesh
   representing a 3D cylinder given as [X1 Y1 Z1 X2 Y2 Z2 R].
   
   [V, F] = cylinderMesh(..., OPT)
   with OPT = 'open' (0) (default) or 'closed' (1), specify if the bases 
   of the cylinder should be included.
   
   [V, F] = cylinderMesh(..., NAME, VALUE);
   Specifies one or several options using parameter name-value pairs.
   Available options are:
   'nPerimeter' the number of circles represeting the perimeter
   'nRho' the number of circles along the hight

   Example
     % Draw a rotated cylinder
     cyl = [0 0 0 10 20 30 5];
     [v, f] = cylinderMesh(cyl);
     figure;drawMesh(v, f, 'FaceColor', 'r');
     view(3); axis equal;

     % Draw three mutually intersecting cylinders
       p0 = [30 30 30];
       p1 = [90 30 30];
       p2 = [30 90 30];
       p3 = [30 30 90];
       [v1 f1] = cylinderMesh([p0 p1 25]);
       [v2 f2] = cylinderMesh([p0 p2 25]);
       [v3 f3] = cylinderMesh([p0 p3 25],'closed','nPeri',40,'nRho',20);
       figure; hold on;
       drawMesh(v1, f1, 'FaceColor', 'r');
       drawMesh(v2, f2, 'FaceColor', 'g');
       drawMesh(v3, f3, 'FaceColor', 'b');
       view(3); axis equal
       set(gcf, 'renderer', 'opengl')
  
   See also
     drawCylinder, torusMesh, sphereMesh

Package: matgeom