theta_impact.m
来自「一个有趣的桌面撞球模拟,可录制avi,输出坐标参数及图象」· M 代码 · 共 51 行
M
51 行
%
% This function recalculates the value of (Theta) depending on the impact
% location
%
%
function th=theta_impact(th,width,height,x0,y0)
if th>0 & th<90
if x0>=width
th=180-th;
return;
elseif y0>=height
th=360-th;
return;
end
elseif th>90 & th<180
if x0<=0
th=180-th;
return;
elseif y0>=height
th=360-th;
return;
end
elseif th>180 & th<270
if x0<=0
th=540-th;
return;
elseif y0<=0
th=360-th;
return;
end
elseif th>270 & th<360
if x0>=width
th=540-th;
return;
elseif y0<=0
th=360-th;
return;
end
elseif th==0 | th==360
th=180;
return;
elseif th==90
th=270;
return;
elseif th==180
th=0;
return;
elseif th==270
th=90;
return;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?