Hello!
I am trying to rotate some points in space, but when I try plotting them, they do not show. I am not sure why as I put markers in my code before and after the displaying line and it looks like the program executes the line, but for some reason it is not showing…
My code is as follows (similar to https://lorensen.github.io/VTKExamples/site/Python/Filtering/AppendFilter/)
points = vtk.vtkPoints()
points.InsertNextPoint(…)
points.InsertNextPoint(…)
points.InsertNextPoint(…)
ug = vtk.vtkUnstructuredGrid()
ug.SetPoints(points)
appendFilter = vtk.vtkAppendFilter()
appendFilter.AddInputData(ug)
appendFilter.Update()
mapper = vtk.vtkDataSetMapper()
mapper.SetInputConnection(appendFilter.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(0.0, 0.0, 1.0)
actor.GetProperty().SetPointSize(10)
ren.AddActor(actor)
I have also tried the following: which it works, but the moment I apply a rotation to them, they disappear and I am not sure why either…
points = vtk.vtkPoints()
points.InsertNextPoint(.....)
points.InsertNextPoint(.....)
points.InsertNextPoint(.....)
pointsPolyData = vtk.vtkPolyData()
pointsPolyData.SetPoints(points)
vertexFilter = vtk.vtkVertexGlyphFilter()
vertexFilter.SetInputData(pointsPolyData)
vertexFilter.Update()
mapper= vtk.vtkPolyDataMapper()
mapper.SetInputData(vertexFilter.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(0.0, 0.0, 1.0)
actor.GetProperty().SetPointSize(10)
ren.AddActor(actor)
For rotating/translating I can apply the vtkTransformPolyDataFilter() and set its input to the vertex/append Filters’s output. Or at least this is how I see what I should do. But the problem is, once I do this, they stop displaying altogether. I tried printing messages during the execution to see if it stops somewhere but as far as that goes, everything goes well. So I am not sure where it stops working.
Any help is appreciated!
-Diana