%Ricostruisco mediante otto telecamere 

%NUOVA

T1=[a{1}' b{1}' c{1}' x_f_as(1)*ones(length(a{1}),1) y_f_as(1)*ones(length(a{1}),1)];
T2=[a{2}' b{2}' c{2}' x_f_as(2)*ones(length(a{2}),1) y_f_as(2)*ones(length(a{2}),1)];
T3=[a{3}' b{3}' c{3}' x_f_as(3)*ones(length(a{3}),1) y_f_as(3)*ones(length(a{3}),1)];
T4=[a{4}' b{4}' c{4}' x_f_as(4)*ones(length(a{4}),1) y_f_as(4)*ones(length(a{4}),1)];
T5=[a{5}' b{5}' c{5}' x_f_as(5)*ones(length(a{5}),1) y_f_as(5)*ones(length(a{5}),1)];
T6=[a{6}' b{6}' c{6}' x_f_as(6)*ones(length(a{6}),1) y_f_as(6)*ones(length(a{6}),1)];
T7=[a{7}' b{7}' c{7}' x_f_as(7)*ones(length(a{7}),1) y_f_as(7)*ones(length(a{7}),1)];
T8=[a{8}' b{8}' c{8}' x_f_as(8)*ones(length(a{8}),1) y_f_as(8)*ones(length(a{8}),1)];

%%Test associa2

R11a2=cell(1,2);
R21a2=cell(1,2);
R31a2=cell(1,2);
R41a2=cell(1,2);


%Associo le telecamere
R11a2{1}=T1;
R11a2{2}=T2;
R21a2{1}=T3;
R21a2{2}=T4;
R31a2{1}=T5;
R31a2{2}=T6;
R41a2{1}=T7;
R41a2{2}=T8;

P11a2=[-1 -10 -1];

%dimensione stanza
dim_stanza_x=10000;
dim_stanza_y=10000;

%secondo passo dell'albero

set(S.tP1R1,'string','-----','visible','on')
set(S.tP1R2,'string','-----','visible','on')
set(S.tP1R3,'string','-----','visible','on')
set(S.tP1R4,'string','-----','visible','on')

tic
[R12a2 P12a2]=associa2(R11a2, R21a2, P11a2, P11a2,epsilon,dim_stanza_x,dim_stanza_y,d_max);
t1=toc;
set(S.tP2R2,'string',t1,'visible','on')
tic
[R22a2 P22a2]=associa2(R31a2, R41a2, P11a2, P11a2,epsilon,dim_stanza_x,dim_stanza_y,d_max);
t2=toc;
set(S.tP2R1,'string',t2,'visible','on')

%terzo passo dell'albero

tic
[R14a2 P14a2]=associa2(R12a2, R22a2, P12a2, P22a2,epsilon,dim_stanza_x,dim_stanza_y,d_max);
t3=toc;
set(S.tP3R1,'string',t3,'visible','on')
tmpo=t3+max([t1 t2]);
set(S.Ttot,'string',tmpo,'visible','on')



