开发者

Are there any libraries that can generate a 3D mesh from a 3D array of data?

I am trying to write some code that takes some data, puts it into a 3-dimensional array, and then generates a 3D mesh for rendering. The data is a list of tiles with fields for defining t开发者_如何转开发he tile's type, etc. I am using Irrlicht for graphics right now and it has ways to manipulate the vertices/indices of a mesh but I can't come up with a fast, efficient way to do it. Are there any libraries or examples of how to do this that anyone knows of?


You want Delaunay triangulation. There are some links at the end of the wikipedia entry. I have used CGAL once for this, but it was quite painful. Note that the problem is particularly ill-conditioned, and you do need a library: CGAL uses some exact arithmetic tricks, hence its cumbersomeness.

Don't do this yourself.

In case you want mesh generation of the convex hull, CGAL provides it too (cumbersome too).


It's unclear what exactly you mean by a 3D array of data, but I guess that you're searching for marching cubes algorithm. It's pretty easy to implement yourself but probably you can find an open-source implementation.


If it's a fully 3D (with internal volumes and intersecting faces) then you need marching cubes or marching tetrahedra

But if it's 2.5D (ie xy and depth/height) then it's much quicker to do a 2D delaunay triangulation on the XY - the best and fastest implementation is triangle but it's not free for commercial use


Agreed with the other posters above -- the Marching Cubes algorithm is the way to go. Personally, I am interested in graphing implicitly defined surfaces. I wrote an introductory Marching Cubes example (that uses Three.js for the graphics) and posted it at:

http://stemkoski.github.com/Three.js/Marching-Cubes.html

For more details on the theory, you should check out the article at

http://paulbourke.net/geometry/polygonise/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜