-
大小: 2KB文件類型: .m金幣: 1下載: 0 次發(fā)布日期: 2021-01-03
- 語言: Matlab
- 標(biāo)簽:
資源簡介
此代碼可用于繪制3D的心形,可以演示給自己的女朋友看哦~
代碼片段和文件信息
function?p?=?MyHeart()
%?Initialize?the?volume?data?figure?and?axes:?
[XYZ]?=?meshgrid(linspace(-33101));?
F?=?-X.^2.*Z.^3-(9/80).*Y.^2.*Z.^3+(X.^2+(9/4).*Y.^2+Z.^2-1).^3;?
hFigure?=?figure;?
sz?=?get(hFigure?‘Position‘);?
set(hFigure?‘Position‘?[sz(1)-0.15*sz(3)?sz(2)?1.3*sz(3)?sz(4)]);?
set(hFigure‘color‘‘w‘?‘menu‘‘none‘)?
hAxes?=?axes(‘Parent‘hFigure‘NextPlot‘‘a(chǎn)dd‘...?
????‘DataAspectRatio‘[1?1?1]...?
????‘XLim‘[30?120]‘YLim‘[35?65]‘ZLim‘[30?75]);?
view([-39?30]);?
axis?off
%?hidden?surface?removal
hidden?on
%?Fill?the?inside?of?the?mesh?with?an?isosurface?to
%?block?rendering?of?the?back?side?of?the?heart
p?=?patch(isosurface(F-0.001));?
set(p‘FaceColor‘‘w‘‘EdgeColor‘‘red‘);?
%?Create?and?plot?contours?in?the?y-z?plane:?
for?iX?=
評論
共有 條評論