On Wed, Feb 16, 2011 at 05:30:08PM +0000, Michele Mattioni wrote:
> Consider this code:
> https://gist.github.com/829727
> The draw of the cylinder is on line 9
> cyl = visual.Cylinder(pos=(coords['x0'],coords['y0'],coords['z0']),
> axis=(x_ax,y_ax,z_ax), radius=1, length=10)
> Basically that line has to go and everything has to be done in tvtk pipeline?
I am attaching code that I propose to replace. It will populate the
Mayavi pipeline (not to be confused with the VTK pipeline). The only loss
of functionality that I see compare to what you are doing would be that
you would need to specify the color via a scalar field and a colormap.
G
import numpy as np
from enthought.mayavi import mlab
from enthought.tvtk.api import tvtk
x, y, z, r, h, s = np.random.normal(size=(6, 20))
h = .1+ np.abs(h)
r = .01+ .1*np.abs(r)
cylinders = [tvtk.CylinderSource(center=(this_x, this_y, this_z),
radius=this_r,
height=this_h,
)
for this_x, this_y, this_z, this_r, this_h
in zip(x, y, z, r, h)]
combined_source = tvtk.AppendPolyData(input=cylinders[0].output)
for cylinder in cylinders:
combined_source.add_input(cylinder.output)
combination = combined_source.output
f = mlab.figure(1, size=(500, 500))
mlab.clf()
surf = mlab.pipeline.surface(combination)
combination.point_data.scalars = np.repeat(s, 24) # 24 points per cylinder
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users