1

I have a dataset of 3-dimensional points for which I'd like to construct a mesh, using python. All the software I've seen requires that you provide the edges. Is there a program in python which takes as the input a set of points in 3D and outputs a set of triangular meshes? If possible, I'd like the meshing to be uniform.

Thank you, - Eli.

Eliezer
  • 747
  • 7
  • 7
  • Are the points representing a surface or a volume? I did this once with delaunay triangulation, but it first required projecting the points on a plane. – wim Feb 23 '12 at 23:16
  • Just thought I'd mention for future reference that [scicomp.SE] is a good place for questions like this. – David Z Feb 23 '12 at 23:50
  • The points represent a surface. Did projection to a plane work well? – Eliezer Feb 24 '12 at 17:25

2 Answers2

1

If the points represent a surface, you can use Delaunay triangulation as suggested by @wim.

import numpy as np
import scipy.spatial
import pylab

data = np.random.random((12,3))            # arbitrary 3D data set
tri = scipy.spatial.Delaunay( data[:,:2] ) # take the first two dimensions

pylab.triplot( data[:,0], data[:,1], tri.simplices.copy() )
pylab.plot( data[:,0], data[:,1], 'ro' ) ;

Delaunay triangulation

From there, the triangles, or simplicies, are accessed through the simplices attribute of the tri object. For example, tri.simplices[0] refers to the first triangle, or simplex, and it returns an array of three integers, say, [ 10, 0, 5 ]. This means that the points making up the first simplex are found at indices, 10, 0, and 5, in the array, data.

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
cjohnson318
  • 3,154
  • 30
  • 33
0

I don't know how easily you can use existing java libraries in python, but Jzy3d may help you to generate meshes from points: there is an orthogonal tesselator for inputs based on points standing on a regular grid, and a delaunay tesselator for an unknown point structures. (disclaimer: I'm the author)

Martin Pernollet
  • 2,285
  • 1
  • 28
  • 39