在Matlab中动态绘制圣诞树
发布时间
阅读量:
阅读量
圣诞节即将来临,特此绘制一棵圣诞树作为礼物分享给大家,相关代码及展示效果如下:
close all;clear;clc
% setup
snow=450; % number of snow flakes [0 .. 5000]
% draw tree
h=0:0.2:25; %vertical grid
[X,Y,Z] = cylinder(tree(h)); %produce a tree formed cylinder
Z=Z*25; %scale to the right heigth
%Add some diffusion to the surface of the tree to make it look more real
treeDiffusion=rand(126,21)-0.5;%some horizontal diffusion data
%add diffusion to the grid points
for cnt1=1:21
for cnt2=16:126%starting above the trunk
%get the angle to always diffuse in direction of the radiu
全部评论 (0)
还没有任何评论哟~
