Align poly data to direction vector

I represent a vtk poly data object that I read with vtkPlyReader and want to align it to given normalized direction vector, so that its orientation matches with that vector.

directionVector = np.array([-0.1134, -0.0695, 0.9911])

plyReader = vtk.vtkPLYReader()

transform = vtk.vtkTransform()
transform.RotateWXYZ(-90, 0, 0, 1) #initial rotation  
transformFilter = vtk.vtkTransformPolyDataFilter()

mapper = vtk.vtkPolyDataMapper()

actor = vtk.vtkActor()


I know that I should use the Rotate() function from vtkTransform but don’t know how to align it.

You might also try this: use vtkGlyph3D. It’s first input is simply a point you want to position the polydata from the ply reader. This first input would also contain a direction vector (contained in the point’s point attribute data) along which to align the glyph. The glyph of course is the polydata from the ply reader (the second input to the filter, the source).

Admittedly this is a hack :slight_smile: You could also study the code in vtkGlyph3D and see how it uses a vector to orient a glyph.

There are some examples that combines the glyph3D and e.g. an arrow source, which contains some vector information, but the whole poly data is then represented as arrow, which I do not look for.

The ply polydata would be the single, oriented glyph placed at a point. This has nothing to do with an arrow etc.