function trnsfm_pts = cv_trnsfm3(trnsfm, pts)
%
% cv_trnsfm3 - apply 4x4 transform matrix to set of points
% Call: trnsfrm_pts = cv_trnsfm3(trnsfm,pts);
% On input:
%     trnsfm: 4x4 transform matrix
%     pts:    n by 3 matrix of points (x,y,z)
% On output:
%     trnsfm_pts: transformed points
% Author:
%     Tom Henderson
%     7 January 1999
% Custom Functions Used:
%     none
% Method:
%     make points homogeneous coordinates (add 4th dimensional component equal to 1)
%     then transpose points to be 4xn; then multiply 4x4 times 4xn
% Testing:
% > tpts = cv_trnsfm3([0 -1 0 1; 1 0 0 2; 0 0 1 3; 0 0 0 1], [0 0 0; 1 0 0; 0 1 0; 0 0 1])
%
% tpts =
%
%     1     2     3
%     1     3     3
%     0     2     3
%     1     2     4
%
% >
%
[rows, cols] = size(pts);
pts_h = [pts ones(rows,1)]';   % add homogeneous component
trnsfm_pts = (trnsfm*pts_h)';  % transform
trnsfm_pts = trnsfm_pts(:,1:3);  % strip homogeneous component

