def line_actor()

in threedod/benchmark_scripts/show_3d_bbox_annotation.py [0:0]


def line_actor(points):
    linesPolyData = vtk.vtkPolyData()
    pts = vtk.vtkPoints()
    lines = vtk.vtkCellArray()
    namedColors = vtk.vtkNamedColors()

    for point in points:
        pts.InsertNextPoint(point)
    linesPolyData.SetPoints(pts)

    for i in range(len(points) - 1):
        line = vtk.vtkLine()
        line.GetPointIds().SetId(0, i)
        line.GetPointIds().SetId(1, i + 1)
        lines.InsertNextCell(line)

    linesPolyData.SetLines(lines)

    # Setup the visualization pipeline
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputData(linesPolyData)

    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    actor.GetProperty().SetLineWidth(4)
    actor.GetProperty().SetColor(namedColors.GetColor3d("Tomato"))
    return actor