File Exchange Pick of the Week

Our best user submissions

Leaf Pile 3D

Sean's pick this week is leafpile3d by Nathaniel Barlow and the extended version with drag by Chris Verhoek.

Last year I picked leaf pile which generated pretty leaves in 2d. Well now there are 3d options! Nathaniel has extended the 2d version to show the leaves falling with gravity.


However, it appears he wrote this so that his students could extend it and add physics to it. I don't know of Chris is one of his students or not, but he extended it and added variable drag based on leaf type, and rotation. I find I'm just sitting here waiting for that last leaf to hit the ground.

leafpile3Dd(30) % added d at end to disambiguate

I also like some of the code changes that Chris made. Specifically, keeping one command per line and splitting some of the longer lines into multiple for readability or better interpretability with source control.

You can see a comparison of the two files in MATLAB by selecting them and comparing to each other or by calling visdiff.

visdiff("leafpile3D.m", "leafpile3Dd.m")


Give it a try and let us know what you think here or leave a comment for Nathaniel or comment for Chris.

Published with MATLAB® R2020b

  • print
  • send email


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.