matlab生成情人节礼物

f=@(x,y,z)x.^2.*z.^3+9*y.^2.*z.^3/80-(x.^2+9*y.^2/4+z.^2-1).^3;  %心形曲线函数
[x,y,z]=meshgrid(-1.5:0.1:1.5);
v=f(x,y,z);
h=patch(isosurface(x,y,z,v,0));
isonormals(x,y,z,v,h);
set(h,'FaceColor','r','EdgeColor','none');
title('I Love you baby');
alpha(0.6);
grid off;
axis([-1.5 1.5 -1.5 1.5 -1.5 1.5]);
lighting Gouraud;
h=camlight('left');
for i=1:360
    camorbit(1,0);
    camlight(h,'left');
    drawnow
end

  

posted on 2017-02-17 14:01  crazy_code1990  阅读(345)  评论(0编辑  收藏  举报