|
楼主 |
发表于 2007-5-23 08:26
|
显示全部楼层
function [xd,yd,zd]=rotx_(x,y,z,th)
cosf=cos(th*pi/180);
sinf=sin(th*pi/180);
xd=x;
yd=cosf.*y-sinf.*z;
zd=sinf.*y+cosf.*z;
function [xd,yd,zd]=roty_(x,y,x,th)
cosf=cos(th*pi/180);
sinf=sin(th*pi/180);
yd=y;
xd=cosf.*x+sinf.*z;
zd=-sinf.*x+cosf.*z;
function [xd,yd,zd]=rotz_(x,y,x,th)
cosf=cos(th*pi/180);
sinf=sin(th*pi/180);
xd=cosf.x-sinf.*y;
yd=sinf.*x+cosf.*y
zd=z;
clear,clf
colormap jet
r=0.601:0.1:2;
imax=length(r);
dth=pi/16;
th=-2*dth:dth:2*dth
[th,zb]=b_design;
jmax=length(th);
for i=1:imax
for j=1:jmax;
x(i,j)=r(i)*cos(th(j));
y(i,j)=r(i)*sin(th(j));
z(i,j)=zb(j);
end
end
zc=z
for i=imax-1:imax
for j=1:jmax
x(i,j)=r(imax-2)*cos(th(j));
y(i,j)=r(imax-2)*sin(th(j));
if i==imax
z(i,j)=(zb(j)+zb(jmax+1-j))*0.5;
end
zc(i,j)=1
end
end
hold on
for k=1:6
angl=60*k
[xb,yb,zb]=rotz_(x,y,z,angl)
mesh(xb,yb,zb,zc)
end
axis([-1.5,1.5,-1.5,1.5,-1.5,1.5])
[xc,yc,zc]=cylinder(0.595,80);
xc(2,:)=xc(1,:);
yc(2,:)=yc(1,:);
zc(1,:)=-ones(size(xc(1,:)))*0.7;
zc(2,:)=ones(size(xc(1,:)))*0.7;
colr=0.7*ones9size(zc));
mesh(xc,yc,zc,colr*0.6)
mesh(xc*0.95,yc*0.95,zc,colr*0.99)
view([-100,20])
function [thb,zb]=b_design
minz=-0.5;
maxz=0.1;
minth=-0.4;
maxth=0.4;
r=0.4;
dth=pi/32;
th=0:dth:2*pi;
x=r*cos(th);
y=r*sin(th).*(x+0.5).*(5-x)/15-(x+0.4).*(x-0.4)+(0.6/0.8)*(x)-0.2;
thb=x;
zb=y; |
评分
-
1
查看全部评分
-
|