%-----------------------------------------------------------
% Carlos Cabral 2003 - Dep.UA

% conversao dos dados laser em dados cartesianos 
%----------------------------------------------------------

function [cart_data, data] = CONVERTDATA2CART(a,i)

% (1)start -----define-----
cm2mm=10; %factor para comverter cm em mm
% (1)end-------------------

    data = a(i , 4:1:363);  % to eliminate the time from de data
    data(length(data)+1)=data(length(data)); % to guaranty that the data have the same size because the model was made with 361 elements and original data has only 360
    data=cm2mm*data; % to convert cm to mm
    
    % incremento angular em radianos 
    t=0:pi/360:pi;
    %representação em espaço cartesiano
    x=data.*cos(t);
    y=data.*sin(t);
    cart_data=[x' y'];    
 