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.
leafpile3D(60)
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")
Comments
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
- 범주:
- Picks
댓글
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.