function ground(varargin)
%GROUND  Draw a ground contact

%   Author(s): A. DiVergilio
%   Copyright 1986-2002 The MathWorks, Inc.
%   $Revision: 1.6 $  $Date: 2002/04/10 06:41:51 $

%---Default properties
p = struct(...
   'Parent',[],...
   'Position',[2 2],...
   'Size',1,...
   'LineWidth',2,...
   'LineStyle','-',...
   'Color','k',...
   'Tag','',...
   'Clipping','off');
plist = fieldnames(p);

%---Merge user-specified properties
for i=1:2:nargin-1
   Property = pnmatch(varargin{i},plist);
   Value = varargin{i+1};
   p.(Property) = Value;
end
if isempty(p.Parent), p.Parent = gca; end

%---Draw a line
s = p.Size;
x = p.Position(1) + [0 0 NaN -s/2 s/2 NaN -s/3.5 s/3.5 NaN -s/16 s/16];
y = p.Position(2) + [0 -0.6*s NaN -0.6*s -0.6*s NaN -0.8*s -0.8*s NaN -s -s];
line(...
   'Parent',p.Parent,...
   'XData',x,...
   'YData',y,...
   'LineWidth',p.LineWidth,...
   'LineStyle',p.LineStyle,...
   'Color',p.Color,...
   'Tag',p.Tag,...
   'Clipping',p.Clipping);
