From: Peter G. <pgr...@ge...> - 2004-04-15 21:54:58
|
> > VTK, including the Python API, does Delaunay triangulation, and I've > used it to do what you're talking about. IIRC, there are other > Delaunay triangulation codes with Python bindings around. However, > the Matlab function is a little more complicated; they use > interpolation in addition to a straight Delaunay triangulation, and > it often produces nice-looking results. They cite a reference in > either the help file or the .m file; one can presumably read the > reference and re-implement it for use in Python. > > FYI, here's some relevant Python VTK code: > > profile = vtkPolyData() > profile.SetPoints(points) > > delny = vtk.vtkDelaunay2D() > delny.SetInput(profile) > delny.SetTolerance(0.01) > delny.BoundingTriangulationOff() > > normals = vtk.vtkPolyDataNormals() > normals.SetInput(delny.GetOutput()) > > lo,hi = zrange > elevation = vtk.vtkElevationFilter() > elevation.SetInput(delny.GetOutput()) > elevation.SetLowPoint(0, 0, lo) > elevation.SetHighPoint(0, 0, hi) > elevation.SetScalarRange(lo, hi) > elevation.ReleaseDataFlagOn() > > delMesh = vtk.vtkPolyDataMapper() > delMesh.SetInput(elevation.GetOutput()) > delMesh.SetLookupTable(lutLand) # doesn't work > delActor = vtk.vtkActor() > delActor.SetMapper(delMesh) > ren1.AddActor( delActor ) Thanks Andrew. I have tried octave with the octive-forge extensions. In fact I have tried two different versions with three different versions of octave-forge. All seem to be broken in one way or another. I get random segmentation faults here and there on data that other times gets processed properly. Their implementation of griddata gives me some areas (triangles) which are empty even though MATLAB produces nice plots - perhaps some convergence issue. In any case I tried using octave's griddata and plot the result using matplotlib's pcolor. If not for the empty triangles (due to griddata) the plots are precisely what I need. I will look into VTK and see what it can do. Peter |