function [yes,result] = checkLocation(surf,newLocation,centroid,yes)                                                                                                                         
result=0;

%Iterate through surf (object)
dimensions = size(surf.vertices);

for i = 1:dimensions(1)
    d = newLocation - surf.vertices(i,:);
    D = norm(d);
    if D < 0.01
      if norm(centroid - newLocation)<=norm(centroid - surf.vertices(i,:)) 
        yes = 1;  
      else yes = 0; 
      end
      break
    end
       
end
if (yes==1)
    result=1;
end