function [VS, vsrc_mic_dist, image_time, sound_level, level, walls, original] = recurse(corners,room,VS,mic,height,level,tmp_l,walls,original)
	c = 343;
	level
	fs = 48000;
	ts = 1/fs;
	
	if (level == 1)
		original = VS';
		VS = getCoords(room,VS)	% vypocet odrazu prvniho radu
		walls = level*ones(1,length(VS));
	elseif (level == 6) %% (rad 8 - cca 4500 s, rad 7 - cca 300 s, rad 6 - cca 50 s, rad 5 - cca 10 s)
		corners;
		l_VS = length(VS);
		
		for i = tmp_l+1:l_VS
			tmp = getCoords(room,VS'(i,:));	% posledni definovany rad odrazu (definovan podminkou v elseif)
			VS = [VS tmp];
		end
		walls = [walls level*ones(1,length(VS))];
		
		% reseni validity zdroje
		ind = find(VS(1,:) == 10e5 | VS(2,:) == 10e5 | VS(3,:) == 10e5);
		useful_VS = [];
		useful_walls = [];
		for i = 1:length(VS)
			if (ind != i)
				useful_VS = [useful_VS VS(:,i)];
				useful_walls = [useful_walls walls(:,i)];
			end
		end
		VS = useful_VS;
		walls = useful_walls;
		
		%% vypocet pro 3D zobrazeni
		zCoord_VS = VS(3,1);
		height = height(1);
		zCoord_VS_ = height-zCoord_VS;
		
			
		% vytvoreni souradnic Z
		for i = 1:level
			if (mod(i,2) == 1)
				zPlus(i) = (i-1)*height+zCoord_VS;
			else
				zPlus(i) = (i-1)*height+zCoord_VS_;
			end
			zMinus(level+1-i) = -zPlus(i);
		end
		zCoord_VS = [zMinus zPlus]
		
		
		% vygenerovani levelu pro vertikalni souradnici
		l_zC = length(zCoord_VS);
		zCoord_walls = [];
		for i = -1*l_zC/2:(l_zC/2)-1
			zCoord_walls = [zCoord_walls abs(i)];
		end		
		
		tmp = 0;
		VS_z = [];
		walls_VS = [];
		walls_z = [];
		VS_orig_z = [];
		walls_orig_z = [];
		% rozsireni virtualnich zdroju do tretiho rozmeru
		for i = 1:l_zC
			tmp = [VS(1:2,:) ; zCoord_VS(i)*ones(1,length(VS))];
			VS_z = [VS_z tmp];
			% rozsireni originalnich zdroju do vysky
			if (zCoord_VS(i) != original(3))
				tmp_o = [original(1:2) ; zCoord_VS(i)];
				VS_orig_z = [VS_orig_z tmp_o];
				walls_orig_z = [walls_orig_z zCoord_walls(i)];
			end
			% vypocet zdi pro utlum
			walls_VS = [walls_VS walls];
			walls_z = [walls_z zCoord_walls(i)*ones(1,length(VS))];
		end
		VS = [VS_orig_z VS_z];
		VS_orig_z;
		
		% soucet vsech poctu zdi
		walls = [walls_orig_z walls_VS + walls_z];
		
		
		% pro vsechny VS je treba spocitat vzdalenost k mikrofonu a nasledne cas, za jaky se dostane zvuk od prislusneho zdroje k mikrofonu
		for j = 1:length(VS)	
			vsrc_mic_dist(:,j) = norm(VS(:,j) - mic');
		end
		image_time = vsrc_mic_dist / c;
		
		% navzorkovani s periodou 1/fs
		samples = floor(image_time ./ ts);
		image_time = samples.*ts;
		
		VS;
		vsrc_mic_dist;
		image_time;

		sound_level = 100*ones(1,length(VS));
		sound_level = sound_level ./ (vsrc_mic_dist .* vsrc_mic_dist);
		
		% utlum odrazu od steny - cinitel odrazu alfa = 0.1 a otoceni faze pri odrazu
		for i = 1:length(VS)
			sound_level(i) = power(0.9,walls(i))*sound_level(i);
			if (mod(walls(i),2) == 1)
				sound_level(i) = -1*sound_level(i);
			end
		end
		
		break;
	else
		l_VS = length(VS);
		if (level == 2)
			tmp_l = tmp_l-1;
		end
		tmp_l;
		for i = tmp_l+1:l_VS
			tmp = getCoords(room,VS'(i,:));		% vypocet odrazu dalsich radu
			VS = [VS tmp];
		end
		walls = [walls level*ones(1,length(VS))];
		tmp_l = l_VS;
		VS;

		corners = power(corners,2);
	end	
	
	level = level + 1;
	[VS, vsrc_mic_dist, image_time, sound_level, level, walls, original] = recurse(corners,room,VS,mic,height,level,tmp_l,walls,original)