function h = bounce(x,y,r,elx,ely,schop,echop,source)
if elx == 0
    elx = 0.4;
end 
if ely == 0
    ely = 1.4;
end
if schop == 100
    schop = 0.05;
    echop = 0.95;
end
if schop == 200
    schop = 0.1;
    echop = 0.9;
end
fprintf('inside')
hold on
dc = echop-schop;
th = schop*pi:dc*pi/200:echop*pi;
xun = elx*r * cos(th) + x;
yun = ely*r * sin(th) + y;
if source == 0
    x2 = fliplr(xun);
    xunit = [xun x2];
    y2 = fliplr(yun);
    yunit = [yun y2];
end
if source == 1
  %  xunit = [fliplr(xun)];
  xunit = xun;
  yunit = yun;
 %   yunit = [fliplr(yun)];
end
fprintf('units')
%h = plot(xunit, yunit,'g*');
%plot(xunit,yunit,'g*');
h = struct('xu',xunit,'yu',yunit);
fprintf('h made')
hold off