# Library of 3D Geometry3

Posted by Jiro Doke,

Jiro's pick this week is geom3d by David Legland.

If you have explored around the File Exchange, you probably have realized that there are entries with varying complexity and quality. Some are very simple few liners (which could still be very useful), while others can be as big as a full toolbox. But what makes certain entries better than others? Is it just the relevancy? Well, if that's the case, then every entry is relevant to someone, so they're all good!

What I've noticed over the years is that there are certain characteristics that make some entries more popular than others. We (Pick of the Week authors) like well-written entries, and if you're hoping to get your entries highlighted in this blog, here are some things to note:

• Relevancy still matters. Tools that resonate with many people are generally good. However, that's not to say that a niche tool isn't useful.
• Good documentation. Imagine that the user of your function knows nothing about how it's written or how to use it. The more help you provide, the better it is.
• Lots of examples. I learn a lot from examples. If they're full demos, those are the best.
• Good comments. I like to look through the code, just to see how things are done. I've learned a lot of new techniques just by examining people's code. If you have good comments in your code, it makes it easier for people to follow your thought process.
• Bug free. Um... yeah.
• Good error handling. The code may be bug free, but you're not guaranteed that the user will provide the appropriate inputs. So if you gracefully handle bad inputs and provide meaningful error messages, that improves the usability trememdously.

Obviously, the list above isn't exhaustive, but it's representative of what I look for in a good entry.

So, let's take a look at "geom3d" by David. This is a huge library of functions for visualizing and creating 3D geometries. There are close to 180 functions for 3d and over 200 functions for 2d. Besides the extensive help that each function has, which is extremely impressive BTW, the part that really caught my eyes was the set of published demo scripts included with the entry. The nice thing about publishing your example files is that File Exchange will nicely display those pages with appropriate syntax highlighting. Here's one of David's published demo scripts.

Let's take a look at one of many examples he has:

[v f] = createSoccerBall;
drawMesh(v, f);
view(3); axis('vis3d'); axis off;
title('Soccer Ball');

Some of the functionalities require his other entry, geom2d. Download both and give them a try! Thanks David for a great entry and the extra effort you put in to make it high quality!

If you have your own favorite File Exchange entry, and we haven't picked it yet, please tell us about it here.

Get the MATLAB code

Published with MATLAB® 7.14

Sven replied on : 1 of 3

Hurrah, I was wondering when geom3d would get in there :)

Mark Selby replied on : 3 of 3

Hi Jiro,
Nice post about submissions and quality, all really good points. One thing I wondered in this area: do The Mathworks have opinions on how best to make open-source submissions and get collaborative projects going, ie “a bit like” SourceForge or Google Code, for use in the MatLAB environment? I’ve often wondered why the FEX doesn’t support this model, I’m sure there are good reasons.

A number of times, I’ve extended the functionality of something I’ve downloaded from here, often addressing what I think is a common Use-Case, but have no way of giving this back to the community without posting whole new submission. Likewise, I’ve not submitted an early stage project because it’s not quite there but also feeling that I’m developing something that a wider community might really latch on to and help take forwards.

Regards,

Mark

These postings are the author's and don't necessarily represent the opinions of MathWorks.