📄 ciib.m
字号:
function ciib=ciib(x,y,z,x0,y0,z0);
ciib=0;
% Rotating to put box on the XY plane
% Moving to the origin of axis
x0=x0-x(1);
y0=y0-y(1);
z0=z0-z(1);
x=x-x(1);
y=y-y(1);
z=z-z(1);
% Rotating the 1-2 line to the X axis
r=sqrt(x(2)^2+y(2)^2+z(2)^2);
aa=asin(abs(z(2))/r);
if (z(2)>=0), thet=pi/2-aa; end;
if (z(2)<0), thet=pi/2+aa; end;
rou=r*sin(thet);
phi=acos(x(2)/rou);
x1=x;
y1=y;
z1=z;
x2=x0;
y2=y0;
z2=z0;
x=x1*cos(phi)+y1*sin(phi);
y=-x1*sin(phi)+y1*cos(phi);
x0=x2*cos(phi)+y2*sin(phi);
y0=-x2*sin(phi)+y2*cos(phi);
x1=x;
y1=y;
z1=z;
x2=x0;
y2=y0;
z2=z0;
x=x1*sin(thet)+z1*cos(thet);
z=-x1*cos(thet)+z1*sin(thet);
x0=x2*sin(thet)+z2*cos(thet);
z0=-x2*cos(thet)+z2*sin(thet);
% Rotating th 1-4 line to the Y axis
%r=sqrt(x(2)^2+y(2)^2+z(2)^2);
%aa=asin(abs(z(2))/r);
%if (z(2)>=0), thet=pi/2-aa; end;
%if (z(2)<0), thet=pi/2+aa; end;
%rou=r*sin(thet);
%phi=acos(x(2)/rou);
%x1=x;
%y1=y;
%z1=z;
%x2=x0;
%y2=y0;
%z2=z0;
%x=x1*cos(phi)+y1*sin(phi);
%y=-x1*sin(phi)+y1*cos(phi);
%x0=x2*cos(phi)+y2*sin(phi);
%y0=-x2*sin(phi)+y2*cos(phi);
%x1=x;
%y1=y;
%z1=z;
%x2=x0;
%y2=y0;
%z2=z0;
%x=x1*sin(thet)+z1*cos(thet);
%z=-x1*cos(thet)+z1*sin(thet);
%x0=x2*sin(thet)+z2*cos(thet);
%z0=-x2*cos(thet)+z2*sin(thet);
if (x0>=min(x)), if (x0<=max(x)), if (y0>=min(y)), if (y0<=max(y)), if (z0>=min(z)), if (z0<=max(z)), ciib=1; end; end; end; end; end; end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -