雪容融matlab代码.docx

上传人:b****4 文档编号:3139332 上传时间:2022-11-17 格式:DOCX 页数:13 大小:20.51KB
下载 相关 举报
雪容融matlab代码.docx_第1页
第1页 / 共13页
雪容融matlab代码.docx_第2页
第2页 / 共13页
雪容融matlab代码.docx_第3页
第3页 / 共13页
雪容融matlab代码.docx_第4页
第4页 / 共13页
雪容融matlab代码.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

雪容融matlab代码.docx

《雪容融matlab代码.docx》由会员分享,可在线阅读,更多相关《雪容融matlab代码.docx(13页珍藏版)》请在冰豆网上搜索。

雪容融matlab代码.docx

雪容融matlab代码

雪容融matlab代码

PART.1代码说明

%椭圆数据点生成函数

function[X,Y]=getEllipse(Mu,XR,YR,theta,pntNum)

%Mu|中心点

%XR,YR|旋转前X,Y半轴长度

%theta|旋转角度

%pntNum|生成数据点个数

tList=linspace(0,2*pi,pntNum);

X=cos(tList).*XR;

Y=sin(tList).*YR;

rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];

XY=rotateMat*[X;Y]+Mu(:

);

X=XY(1,:

);Y=XY(2,:

);

end

这次代码还用到各种旋转过后的正弦函数,因此最后的局部函数还包含一个旋转数据的局部函数。

%数据旋转角度

function[X,Y]=rotateData(X,Y,theta)

rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];

XY=rotateMat*[X;Y];

X=XY(1,:

);Y=XY(2,:

);

end

PART.2完整代码

functionxuerongrong

ax=gca;

ax.DataAspectRatio=[111];

ax.XLim=[-55];

ax.YLim=[-55];

hold(ax,'on')

 

%绘制胳膊

[X,Y]=getEllipse([-1,-2.5],.4,.6,-pi/5,200);

fill(X,Y,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)

[X,Y]=getEllipse([1.7,-1.89],.4,.6,pi/3.6,200);

fill(X,Y,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)

%绘制腿

rectangle('Position',[-.95,-4.2,1.3,1],'Curvature',.8,...

'FaceColor',[182,50,2]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)

rectangle('Position',[-1,-3.9,1.4,1],'Curvature',.8,...

'FaceColor',[246,168,68]./255,'EdgeColor',[246,168,68]./255,'LineWidth',1.8)

rectangle('Position',[-1,-3.8,1.4,1],'Curvature',.8,...

'FaceColor',[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)

rectangle('Position',[.5,-4.2,1.2,2],'Curvature',.8,...

'FaceColor',[182,50,2]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)

rectangle('Position',[.45,-3.9,1.3,2],'Curvature',.8,...

'FaceColor',[246,168,68]./255,'EdgeColor',[246,168,68]./255,'LineWidth',1.8)

rectangle('Position',[.45,-3.8,1.3,2],'Curvature',.8,...

'FaceColor',[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)

 

%绘制身体

rectangle('Position',[-.9,-3.5,2.6,3],'Curvature',.6,...

'FaceColor',[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)

%绘制头

[X0,Y0]=getEllipse([-.15,.65],2.9,2.3,pi/11,200);

fill(X0,Y0,[212,3,28]./255,'EdgeColor',[153,12,40]./255,'LineWidth',1.8)

[X,Y]=getEllipse([-.15,.65],2.7,2.3,pi/11,200);

plot(X,Y,'Color',[236,136,74]./255,'LineWidth',1.8)

 

[X,Y]=getEllipse([-.15,.65],1.7,2.3,pi/11,200);

plot(X,Y,'Color',[236,136,74]./255,'LineWidth',1.8)

X=linspace(0,pi,100);Y=sin(X);

X=X.*1.4;Y=Y.*0.2;

[X,Y]=rotateData(X,Y,-pi/11);

plot(Y+.41,X-1.46,'Color',[236,136,74]./255,'LineWidth',2)

plot(X0,Y0,'Color',[212,3,28]./255,'LineWidth',3)

%绘制脸上的云

[X,Y]=getEllipse([-1.2,-.3],.5,.6,pi/3.4,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([-1.3,.4],.45,.55,-pi/3.4,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([-.65,1],.45,.7,-pi/4,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([0,1],.45,.7,-pi/4,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([1.8,.5],.4,.5,pi/5,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([1.63,.92],.4,.5,pi/12,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([.3,.25],1.6,1,pi/13,200);

fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)

[X,Y]=getEllipse([.95,1.42],.3,.3,pi/12,200);

fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)

%绘制腮红

[X,Y]=getEllipse([-1.1,-.5],.35,.35,pi/12,200);

fill(X,Y,[212,3,28]./255,'EdgeColor','none','FaceAlpha',.2)

[X,Y]=getEllipse([-1.1,-.5],.32,.32,pi/12,200);

fill(X+3,Y+.9,[212,3,28]./255,'EdgeColor','none','FaceAlpha',.2)

%绘制眼睛

[X,Y]=getEllipse([-.76,.16],.15,.24,pi/20,200);

fill(X,Y,[38,23,26]./255,'EdgeColor',[38,23,26]./255)

[X,Y]=getEllipse([1.25,.47],.15,.24,pi/20,200);

fill(X,Y,[38,23,26]./255,'EdgeColor',[38,23,26]./255)

[X,Y]=getEllipse([-.81,.21],.05,.05,pi/20,200);

fill(X,Y,[230,230,230]./255,'EdgeColor','none')

[X,Y]=getEllipse([1.2,.52],.05,.05,pi/20,200);

fill(X,Y,[230,230,230]./255,'EdgeColor','none')

 

%%绘制头饰

[X,Y]=getEllipse([-1.85,2.2],.48,.15,pi/20,200);

fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)

[X,Y]=getEllipse([-.7,2.4],.47,.2,pi/15,200);

fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)

[X,Y]=getEllipse([.32,2.55],.47,.15,pi/15,200);

fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)

[X,Y]=getEllipse([1.2,2.6],.25,.14,pi/30,200);

fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)

%

[X,Y]=getEllipse([-1.8,2.1],.08,.2,-pi/10,200);

fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)

[X,Y]=getEllipse([-.7,2.3],.08,.2,-pi/40,200);

fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)

[X,Y]=getEllipse([.4,2.5],.08,.2,-pi/40,200);

fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)

[X,Y]=getEllipse([1.25,2.5],.04,.12,pi/10,200);

fill(X,Y,[212,3,28]./255

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1