• Remix
  • Share
  • New Entry

on 25 Oct 2021
  • 11
  • 82
  • 0
  • 0
  • 280
% Rumbo Punkins are flatter, and light tan in color
% For a classic orange pumpkin, see my other pumpkin script.
% https://www.mathworks.com/matlabcentral/communitycontests/contests/4/entries/6893
% For detailed comments with character savings tips, see that script.
% These have fewer ridges than the o.g. punkin.
% To make the math for 8 bumps work, change resolution so the simple colonop step is still .1.
[X,Y,Z]=sphere(160);
% Add secondary ridges to this pumpkin.
R=1+(-(1-mod(0:.1:16,2)).^2)/20+(-(1-mod(0:.2:32,2)).^2)/20;
% Make this squatter, and increase the dimple size at the top to better mimic this breed.
% New trick this time, use P=V syntax for name/value pairs to save 2 chars for the quotes.
% 2nd new trick, use 3 element color hex codes to save 3 chars per color.
% Less accurate colors, but close enough.
surf(R.*X,R.*Y,(.8+(0-(1:-.0125:-1)'.^4)*.3).*Z.*R.*.8,FaceC='#c96',EdgeC='n')
% Recycle the sphere coords for the stem.
surface(X/12,Y/12,Z/3+.4,FaceC='#472', EdgeC='n')
% Setup the axes. Use command-dual version of title to save the ') at end.
axis equal off
title Rumbo.Punkin
% Setup lighting parameters.
lighting g
material([.6 .7 .2 3 .5])
camlight
Remix Tree