function [lh, sh] = lsurf(location, color)
% creates a light, and puts a small sphere
% at its location to show its position.  The
% sphere's FaceColor is set to the light's color.
% The sphere is immune to the effects of lighting.m,
% because it has a ChangeFcn callback that resets
% FaceLighting to 'none' if it ever changes.
%
 
%   Damian Packer
%   Copyright (c) 1984-98 by The MathWorks, Inc. All Rights Reserved
%   $Revision: 1.4 $
%   $Date: 1997/12/03 17:29:54 $

% plane function calls this file
l = light('Position',location,'Color',color);
[x,y,z]=sphere;
x = x+location(1);
y = y+location(2);
z = z+location(3);
s = surface('XData',x,'YData',y,'ZData',z,...
    'FaceColor',color,'FaceLighting','g',...
    'EdgeColor','none','AmbientStrength',.9,...
    'Clipping','off','Tag','lightbulb');
[x,y,z]=cylinder;
x = [x;x]/2 + location(1);
y = [y;y]/2 + location(2);
z = [z;z+2]/3 +1 + location(3);
s(2) = surface('XData',x,'YData',y,'ZData',z,...
    'FaceColor',[.6 .6 .6],'FaceLighting','g',...
    'EdgeColor','k','AmbientStrength',.9,...
    'Clipping','off','MeshStyle','r',...
    'Tag','lightstem','linewidth',4);

if nargout > 0
  lh = l;
  if nargout > 1
     sh = s;
   end
end

