This one is a fun and well-written example of 3D graphics using basic patch objects. You can draw 13 different kinds of fruits with ability to specify geometric parameters. For example, here’s a strawberry.
s = fruit.strawberry([0 0 0], 5); view(3) light
To change the orientation, you simply use the rotate function.
rotate(s,[0 1 0],-45)
Let’s place a slice of lemon on the side.
l = fruit.lemon([5 8 0],10); rotate(l,[1 0 0],-45)
Now, enjoy your fruit plate! (from the FEX entry)
Get the MATLAB code
Published with MATLAB® R2017b
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.