[vtkusers] Translate all VTK glyphs individually in large dataset
Charles Kind
charles.kind at bristol.ac.uk
Fri Dec 1 05:09:58 EST 2017
What is needed here is a Warp Vector. As the displacements have already been
calculated as mtrans these can then be applied to the point set in order to
warp it to the new configuration. The point set is the origin points for the
glyphs. Below is a section of code from below the subsample grid.
#Cast data into PolyData format for warping
pd = vtk.vtkPolyData()
pd.SetPoints(extract.GetOutput().GetPoints())
pd.GetPointData().SetVectors(extract.GetOutput().GetPointData().GetAbstractArray(2))
#Warp vector origins
warpVector = vtk.vtkWarpVector()
warpVector.SetInputData(pd)
warpVector.SetScaleFactor(1e-07)
warpVector.Update()
#Cast warped points and original vectors into PolyData for rendering
warped = vtk.vtkPolyData()
warped.SetPoints(warpVector.GetOutput().GetPoints())
warped.GetPointData().SetVectors(extract.GetOutput().GetPointData().GetAbstractArray(1))
arrowSource = vtk.vtkArrowSource()
glyph3D = vtk.vtkGlyph3D()
glyph3D.SetSourceConnection(arrowSource.GetOutputPort())
glyph3D.SetVectorModeToUseVector()
glyph3D.SetInputData(warped)
glyph3D.SetScaleFactor(1e-07)
glyph3D.Update()
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
More information about the vtkusers
mailing list