National Jelly-Filled Doughnut Day
National Doughnut Day was June 3rd. On that day, Sean Breckling was nice enough to tweet this to the universe of MATLAB users:
https://twitter.com/BikeMath/status/738818666448314369
I sampled his code (below) and found it delicious, although it had a slight metallic taste (note the copper colormap).
X = imread('sprinkles.jpg'); t = 0:0.01:1; nt = max(size(t)); outside = 2 + sqrt(1 - t.*t); inside = 2 - sqrt(1 - t.*t); [x,y,z] = cylinder(outside); [xx,yy,zz] = cylinder(inside); surf(x,y,z, 'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); hold on surf(x,y,-z, 'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); surf(xx,yy,zz, 'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); surf(xx,yy,-zz,'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); axis tight equal off; colormap('copper'); warp(x,y,z,X) warp(xx,yy,zz,X) hold off
Sorry it took me a while to notice your tweet, Sean. I may be too late to wish you a Happy National Doughnut Day, but by a
fortunate coincidence, today is National Jelly-Filled Doughnut Day (strange but true!). So Happy National Jelly-Filled Doughnut
Day!
In honor of this occasion, here is a doughnut-themed Cody problem: Would Homer Like It?
And finally, through the magic of spherical coordinates, we’ll close with a gratuitous animation. Because doughnut. Mmmm… doughnut.
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.