function [Pr]=rotTransSeg(P, T, ang)
% This function performs the
% roto-translation of a segment 
% whose coordinates are stored 
% in the matrix P 
%
% Stefano De Marchi, Dec. 2009
% ----------------------------
% P = n x 2 matrix 
%     P=[x1 y1
%        x2 y2]
%
% T = translation vector
%
% ang = rotation angle
%----------------------
% Pr = P after rotation
% ---------------------        

% Translation 
TT=[T;T];
P=P+TT;

% Rotation of ang
M=[cos(ang) -sin(ang) 
   sin(ang) cos(ang)];
 
 S=M*P(2,:)';
 P(2,:)=S';
  
 Pr=P;
 return