function pts = cv_cyl_pts(radius, cyl_length, step_angle, step_len)
%
% cv_cyl_pts - generate sample of points on a cylinder
% Call: pts = cv_cyl_pts(radius,cyl_length,step_angle,step_len);
% On input:
%     radius: radius of cylinder
%     cyl_length: length of sample of cylinder
%     step_angle: distance (in radians) between samples around cylinder
%     step_len: distance between samples along cylinder
% On output:
%     pts: matrix of sample points/normals from cylinder (n by 6)
% Author:
%     Tom Henderson
%     7 January 2000
% Custom Functions Used:
%     none
% Method:
%     generate circle of points; translate from -cyl_length/2 to cyl_length/2 in z
% Testing:
% > c = cv_cyl_pts(1,1,pi/2,0.5);
%
% c =
%
%    1.0000         0   -0.5000    1.0000         0         0
%    0.0000    1.0000   -0.5000    0.0000    1.0000         0
%   -1.0000    0.0000   -0.5000   -1.0000    0.0000         0
%   -0.0000   -1.0000   -0.5000   -0.0000   -1.0000         0
%    1.0000   -0.0000   -0.5000    1.0000   -0.0000         0
%    1.0000         0         0    1.0000         0         0
%    0.0000    1.0000         0    0.0000    1.0000         0
%   -1.0000    0.0000         0   -1.0000    0.0000         0
%   -0.0000   -1.0000         0   -0.0000   -1.0000         0
%    1.0000   -0.0000         0    1.0000   -0.0000         0
%    1.0000         0    0.5000    1.0000         0         0
%    0.0000    1.0000    0.5000    0.0000    1.0000         0
%   -1.0000    0.0000    0.5000   -1.0000    0.0000         0
%   -0.0000   -1.0000    0.5000   -0.0000   -1.0000         0
%    1.0000   -0.0000    0.5000    1.0000   -0.0000         0
%
% >  = cv_()
%
circle_pts = [];
pts = [];
for angle = 0:step_angle:2*pi    % generate the circle points
   c = cos(angle);
   s = sin(angle);
   circle_pts = [circle_pts; radius*c, radius*s, 0 c,s,0];
end

for z = -cyl_length/2:step_len:cyl_length/2   % add circle points along length
   slice = circle_pts;
   slice(:,3) = z;
   pts = [pts; slice];
end
