function [gl_origin, r_sphere] = volume_bounds(setup)
	% gl_origin, r_sphere = volume_bounds(setup)
	%
	% determine the largest sphere which is visible in each camera
	% of the camera setup specified by setup
	%
	% returns the origin and radius of the sphere in each view
	
	%% determine size + center of volume
	% find point closest to center of each image in all cameras
	n_cameras					= setup.n_cameras;
	ij_origin					= zeros(2,1,n_cameras);
	for cam_idx = 1 : n_cameras
		i_axis					= setup.camera(cam_idx).i_axis;
		j_axis					= setup.camera(cam_idx).j_axis;
		ij_origin(:,1,cam_idx)= [sum(i_axis([1 end]))/2;	
										sum(j_axis([1 end]))/2];
	end
	gl_origin					= triangulate(setup.camera, ij_origin, true);

	% find size of inscribed sphere
	r_sphere						= zeros(1, n_cameras);
	for c = 1 : n_cameras
		M							= frustum(setup.camera(c));
		frustum_dist			= M * [gl_origin(:);1];
		r_sphere(c)				= min(abs(frustum_dist));
	end
end


