%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  findClosest2
%  findClosest2 takes a list of cell generators and a point and returns the index
%  of the cell generator nearest to the point, and the distance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [nearest,distance] = findClosest( cellGens, point )
	distance = realmax;
	r = size( cellGens,1 );
	for i = 1:r
		
		distSq = sum( ( cellGens(i,:) - point ).^2 );
		if distSq < distance 
			distance = distSq;
			nearest = i;
		end 
	end
	distance = sqrt( distance );
