On Tue, Aug 04, 2009 at 11:42:36PM -0400, Tom Foutz wrote:
> Hi, I am working on a triangular mesh of data, and I am trying to
> interpolate values that are between vertices.� I have come up with the
> following method:, based on Gael's previous examples.� However, I always
> get an array of 0.0 for output.
It is hard to say, as the example you give does not run, and thus does
not allow to test the problem.
I am tempted to say that this is because you have a cloud of points that
does not define a good interpolation domain.
I have modified your example so that it works, but I have not added any
fundemental differences.
Ga�l
from enthought.mayavi import mlab
from enthought.tvtk.api import tvtk
import numpy as np
x, y, z, s = np.random.random((4, 10))
mlab.clf()
pts = mlab.points3d(x, y, z, s)
def interpolate_voltage(x, y, z, pts):
delaunay = mlab.pipeline.delaunay3d(pts)
unstructured_grid = delaunay.outputs[0]
shape = x.shape
x = np.atleast_1d(x)
y = np.atleast_1d(y)
z = np.atleast_1d(z)
probe_data = tvtk.PolyData(points=np.c_[x.ravel(), y.ravel(), z.ravel()])
probe = tvtk.ProbeFilter()
probe.input = probe_data
probe.source = unstructured_grid
probe.update()
values = probe.output.point_data.scalars.to_array()
values = np.reshape(values, shape)
return values
X, Y, Z = np.mgrid[-1:1:10j, -1:1:10j, -1:1:10j]
interp_volt = interpolate_voltage(X, Y, Z, pts)
mlab.contour3d(X, Y, Z, interp_volt, transparent=True, opacity=0.5)
mlab.show()
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users