rjpj1998
rjpj1998

Reputation: 419

Plotting a 3d triangular mesh from point cloud

I have this object/point cloud,rendered with pyopengl and pygame.

enter image description here

My object is a numpy array of the co-ordinates of the point. I wish to generate a 3d triangular mesh of this object, also it would be nice if you could decrease the number of triangles.

I have tried scipy.spatial.Delaunay and it doesnt generate triangles for 3d objects.

Upvotes: 0

Views: 2005

Answers (1)

Mykel Stone
Mykel Stone

Reputation: 321

Dual Contouring would probably work well here, it's an algorithm that takes voxelized data and turns it into a mesh. I don't understand it trivially enough to outline it here, but basically you'd take your array of points and place them into a 3D grid array where if that grid cell contains a point it's set to equal 1 (full), and if it doesn't it is set to 0 (empty), you would then run the DC algorithm on this grid and it would output a mesh. The nice thing about this algorithm is it supports internal cavities and concave shapes.

Here's some links I found that may help you if you decide to use DC:

Basic Dual Contouring Theory http://ngildea.blogspot.com/2014/11/implementing-dual-contouring.html

This is the github repo to the source I used when I implemented this algorithm in Unity3D: https://github.com/nickgildea/DualContouringSample

Upvotes: 1

Related Questions