libraries for regular geometric objects

Recommended Posts

darkpegasus    269
So I'd like to play around with some different geometric shapes like 3D hexagons, octagons, and icosahedrons but my math skills are somewhat lacking when trying to realize these in 3D. I'm sure I can't be the only person that's ever tried to make these, so there is there a library somewhere (preferably in C) that I could give parameters like side length and 'depth' that will return vertex points for things like vertices, normals, and texture coordinates?

Share on other sites
jyk    2094
Quote:
 Original post by darkpegasusSo I'd like to play around with some different geometric shapes like 3D hexagons, octagons, and icosahedrons but my math skills are somewhat lacking when trying to realize these in 3D. I'm sure I can't be the only person that's ever tried to make these, so there is there a library somewhere (preferably in C) that I could give parameters like side length and 'depth' that will return vertex points for things like vertices, normals, and texture coordinates?
I wrote a pretty comprehensive procedural mesh generator at one point, but unfortunately it's in C++ and the code is a big mess.

However, a lot of these shapes are pretty easy to generate procedurally, so I wouldn't shy away from doing it yourself if I were you.

A good place to start might be Dave Eberly's site geometrictools.com. Somewhere on his site is a PDF that includes vertex and connectivity data for various Platonic solids (tetrahedron, octahedron, dodecahedron, etc.), which would probably be a good starting point. Prisms and cylinders are pretty easy to make as well.

If you have particular questions about how to make these or other shapes, you can always ask in Math & Physics.

Share on other sites
darkpegasus    269
Thanks jyk, I'll check that site out.

I guess what gets me is that I could figure out triangles if I sat down and drew things out but my ability (read lack thereof) to visualize equations doesn't help when I try to create objects programatically.