function pts = cv_rect_pts(side_x, side_y, step_x, step_y)
%
% cv_rect_pts - generate sample of points on rectangle in plane
% Call: pts = cv_rect_pts(side_x,side_y,step_x,step_y);
% On input:
%     side_x: length of side in x direction
%     side_y: length of side in y direction
%     step_x: x distance between sample points
%     step_y: y distance between sample points
% On output:
%     pts: set of sample points/normals in rectangle; n by 6 matrix: (x,y,z,a,b,c) 
% Author:
%     Tom Henderson
%     7 January 1999
% Custom Functions Used:
%     none
% Method:
%     Generate all points in rectangle defined by x range (-side_x/2,side_x/2) 
% and y range (-side_y/2,side_y/2) about origin.  The normal vector is in z-axis
% direction.  
% Testing:
% > pts = cv_rect_pts(2,2,1,1)
%
% pts =
%
%    -1    -1     0     0     0     1
%    -1     0     0     0     0     1
%    -1     1     0     0     0     1
%     0    -1     0     0     0     1
%     0     0     0     0     0     1
%     0     1     0     0     0     1
%     1    -1     0     0     0     1
%     1     0     0     0     0     1
%     1     1     0     0     0     1
%
% >
% 
x_vals = -side_x/2:step_x:side_x/2;
y_vals = -side_y/2:step_y:side_y/2;
x_len = length(x_vals);
y_len = length(y_vals);
pts_index = 0;
pts = zeros(x_len*y_len,6);
pts(:,6) = 1;
for x_index = 1:x_len    % generate points in rectangle
   x = x_vals(x_index);
   for y_index = 1:y_len
      y = y_vals(y_index);
      pts_index = pts_index + 1;
      pts(pts_index,1) = x;
      pts(pts_index,2) = y;
   end
end
