display subsets of vtkPoints using different glyphs
I am trying to display some timeseries data in 3D using colormapped values using VTK. I have a single array of 3D positions for two different kinds of objects, say cones and spheres. These positions are interspersed. I also have a 2D array with timeseries data for these objects. n-th entry in position array correponds to n-th row in timeseries array. (all these are numpy arrays).
Now开发者_如何学Go I want an animated display (using python-vtk) of the cones and the spheres with their colors varying according to the entries in the timeseries array. Currently I made it work by splitting each of the arrays into two - one for cones and one for spheres. But ideally I would like to just pipe cone entries of the position array through a coneGlyph and sphere entries through a sphere glyph and set the timeseries values for all the positions directly. What is the way to do that, if possible at all?
I bypassed the issue by storing the indices of the two kinds of objects (i.e., cone_indices and sphere_indices). I also create to vtkPoints objects with the cone positions and the sphere positions. These are used to create the vtkPolyData for the respective classes. In the update method of the timer class, I use these index-arrays to pick up the data for that time point for each type and assign the scalar values to the point data.
conePoints.GetPointData().SetScalars(coneData)
spherePoints.GetPointData().SetScalars(sphereData)
numpy's array lookup using an index-array is fast enough.
精彩评论