-3
我正在尋找一個Matlab代碼來創建一棵聖誕樹 也許一些三角形在彼此之上,並且有一些圓形的矩形作爲裝飾。使用[Matlab]創建聖誕樹
我正在尋找一個Matlab代碼來創建一棵聖誕樹 也許一些三角形在彼此之上,並且有一些圓形的矩形作爲裝飾。使用[Matlab]創建聖誕樹
沒有什麼比這更簡單,只需使用fill
和annotation
figure;
hold on;
axis off;
% Strunk
fill([3,3,4,4],[0,1,1,0],[139,69,19]./255,'LineStyle','none')
% Tree
x = [1,6,5,5.5,4.5,5,3.5,2,2.5,1.5,2,1]
y = [1,1,3,3,5,5,8,5,5,3,3,1]
fill(x,y,'g','LineStyle','none')
% Decoration
annotation('ellipse',[0.3,0.5,0.05,0.05],'Color','red','FaceColor','red')
annotation('ellipse',[0.6,0.3,0.05,0.05],'Color','red','FaceColor','red')
annotation('ellipse',[0.55,0.6,0.05,0.05],'Color','red','FaceColor','red')
提供一些細節。 – Hemal