close all;
clear all;
Bound=[0 8 0 8];
global xt;
global yt;
global zt;
global flag;
global factor;
factor=280;
yt=0;
x=[];
TableColour=[.5 .5 .5];
%axes('parent',gcf,'unit','normalized','position',[0 0.1 0.7 0.7])
h_axes=axes('parent',gcf,'unit','normalized','position',[0 0.1 0.7 0.7],'Color',[0 0 0],'xcolor',TableColour,'ycolor',TableColour,'PlotBoxAspectRatio',[1 1 1]);
axis(Bound);
hold on;
grid on;
set(gcf,'outerposition',get(0,'screensize'));
h_text=uicontrol(gcf,'Style','text','unit','normalized','string','experiment of billiard','position',[0.25 0.85 0.2 0.05],'fontsize',15,'ForegroundColor','k','FontWeight','bold','backgroundcolor',[0.8 0.8 0.8]);
h1=uicontrol(gcf,'style','pushbutton','unit','normalized','position',[0.01 0.1 0.05 0.03],'string','exit','callback','close(gcf)');
h1=uicontrol(gcf,'style','pushbutton','unit','normalized','position',[0.01 0.3 0.05 0.03],'string','reset','callback','clear all;main');
h11=uicontrol(gcf,'Style','text','unit','normalized','String','enter X','position',[0.7 0.6 0.05 0.03],'back',[1 1 0]);
h44=uicontrol(gcf,'Style','text','unit','normalized','String','enter rayon','fontsize',7,'position',[0.7 0.55 0.05 0.03],'back',[1 1 0]);
h22=uicontrol(gcf,'Style','text','unit','normalized','String','enter Y ','position',[0.7 0.65 0.05 0.03],'back',[1 1 0]);
h33=uicontrol(gcf,'Style','text','unit','normalized','String','enter Angle ','fontsize',7,'position',[0.7 0.7 0.05 0.03],'back',[1 1 0]);
h55=uicontrol(gcf,'Style','text','unit','normalized','String','enter speed','fontsize',7,'position',[0.7 0.5 0.05 0.03],'back',[1 1 0]);
h2=uicontrol(gcf,'Style','edit','unit','normalized','position',[0.75 0.6 0.05 0.03],'callback','x(1)=str2num(get(gcbo,''string''))');
h3=uicontrol(gcf,'Style','edit','unit','normalized','position',[0.75 0.65 0.05 0.03],'callback','x(2)=str2num(get(gcbo,''string''))');
h4=uicontrol(gcf,'Style','edit','unit','normalized','position',[0.75 0.7 0.05 0.03],'callback','k=str2num(get(gcbo,''string''));k=k*pi/180');
h5=uicontrol(gcf,'Style','edit','unit','normalized','position',[0.75 0.55 0.05 0.03],'callback','r=str2num(get(gcbo,''string''))');
h6=uicontrol(gcf,'Style','edit','unit','normalized','position',[0.75 0.5 0.05 0.03],'callback','vv=str2num(get(gcbo,''string''))');
hold on
c=[]; % matrix of error detect
nb=2; % number of obstacle
m=[]; % matrix of judge special situation
DT=0.005;
vv=2;
A(:,:,1)=[3 5 5 3 3;3 3 5 5 3];
A(:,:,2)=[2 5 5 2 2;0 0 1 1 0];
Obstacle(1,:)=[3 5 3 5];
Obstacle(2,:)=[2 5 0 1];
h=uicontrol(gcf,'style','pushbutton','unit','normalized','position',[0.85 0.75 0.08 0.05],'string','Draw obstacle','Fontsize',7,'callback','plotobstacle(A)');
h=uicontrol(gcf,'style','pushbutton','unit','normalized','position',[0.85 0.8 0.08 0.05],'string','Draw','callback','plot111(x,A,Bound,DT,vv,r,nb,k,m,Obstacle)');
h=uicontrol(gcf,'style','pushbutton','unit','normalized','position',[0.85 0.7 0.08 0.05],'string','Draw2','callback','plot222(x,A,Bound,DT,vv,r,nb,k,m,Obstacle)');