def addTrail(self, offset=None, maxlength=None, n=25, c=None, alpha=None, lw=1):
        """Add a trailing line to actor.

        :param offset: set an offset vector from the object center.
        :param maxlength: length of trailing line in absolute units
        :param n: number of segments to control precision
        :param lw: line width of the trail

        .. hint:: |trail| |trail.py|_
        """
        if maxlength is None:
            maxlength = self.diagonalSize() * 20
            if maxlength == 0:
                maxlength = 1

        if self.trail is None:
            pos = self.GetPosition()
            self.trailPoints = [None] * n
            self.trailSegmentSize = maxlength / n
            self.trailOffset = offset

            ppoints = vtk.vtkPoints()  # Generate the polyline
            poly = vtk.vtkPolyData()
            ppoints.SetData(numpy_to_vtk([pos] * n))
            poly.SetPoints(ppoints)
            lines = vtk.vtkCellArray()
            lines.InsertNextCell(n)
            for i in range(n):
                lines.InsertCellPoint(i)
            poly.SetPoints(ppoints)
            poly.SetLines(lines)
            mapper = vtk.vtkPolyDataMapper()

            if c is None:
                if hasattr(self, "GetProperty"):
                    col = self.GetProperty().GetColor()
                else:
                    col = (0.1, 0.1, 0.1)
            else:
                col = colors.getColor(c)

            if alpha is None:
                alpha = 1
                if hasattr(self, "GetProperty"):
                    alpha = self.GetProperty().GetOpacity()

            mapper.SetInputData(poly)
            tline = Actor()
            tline.SetMapper(mapper)
            tline.GetProperty().SetColor(col)
            tline.GetProperty().SetOpacity(alpha)
            tline.GetProperty().SetLineWidth(lw)
            self.trail = tline  # holds the vtkActor
            return self
def addTrail ( self , offset = None , maxlength = None , n = 25 , c = None , alpha = None , lw = 1 ) : if maxlength is None : maxlength = self . diagonalSize ( ) * 20 if maxlength == 0 : maxlength = 1 if self . trail is None : pos = self . GetPosition ( ) self . trailPoints = [ None ] * n self . trailSegmentSize = maxlength / n self . trailOffset = offset ppoints = vtk . vtkPoints ( ) poly = vtk . vtkPolyData ( ) ppoints . SetData ( numpy_to_vtk ( [ pos ] * n ) ) poly . SetPoints ( ppoints ) lines = vtk . vtkCellArray ( ) lines . InsertNextCell ( n ) for i in range ( n ) : lines . InsertCellPoint ( i ) poly . SetPoints ( ppoints ) poly . SetLines ( lines ) mapper = vtk . vtkPolyDataMapper ( ) if c is None : if hasattr ( self , "GetProperty" ) : col = self . GetProperty ( ) . GetColor ( ) else : col = ( 0.1 , 0.1 , 0.1 ) else : col = colors . getColor ( c ) if alpha is None : alpha = 1 if hasattr ( self , "GetProperty" ) : alpha = self . GetProperty ( ) . GetOpacity ( ) mapper . SetInputData ( poly ) tline = Actor ( ) tline . SetMapper ( mapper ) tline . GetProperty ( ) . SetColor ( col ) tline . GetProperty ( ) . SetOpacity ( alpha ) tline . GetProperty ( ) . SetLineWidth ( lw ) self . trail = tline return self
Add a trailing line to actor.

        :param offset: set an offset vector from the object center.
        :param maxlength: length of trailing line in absolute units
        :param n: number of segments to control precision
        :param lw: line width of the trail

        .. hint:: |trail| |trail.py|_