• Remix
  • Share
  • New Entry

on 11 Oct 2021
  • 24
  • 115
  • 0
  • 0
  • 280
% Create pumpkin
f=@(x)linspace(-x,x,500);
t=f(pi);
p=f(pi/2)';
c=cos(p);
k=abs(sin(f(4*pi)))*.1+.9; % adds pumpkin ripples; in n*pi, n controls the amount of ripples
g=exp(-(-249:250)'.^2/8E4); % Gaussian to control top/bottom pumpkin indentations
x=c*cos(t).*k;
y=c*sin(t).*k;
z=sin(p)*t./t;
surf(x,y,z.*g,k.*c./c,EdgeC='n') % plot pumpkin with darker creases
% Add stem
hold
Current plot held
[q,r,s]=cylinder(.3-1./(1+exp(f(-8)-4))*.1,8); % sigmoidal stem profile so it's fat at the base
surf(q,r,s*.4+.5,EdgeC='n');
% axis equal
axis off
colormap(copper)
view(9,9)
% % Improvements:
% camva(5)
% axis equal
Remix Tree