code: def decimate(self, fraction=0.5, N=None, boundaries=False, verbose=True):
          
          poly = self.polydata(True)
          if N:  # N = desired number of points
              Np = poly.GetNumberOfPoints()
              fraction = float(N) / Np
              if fraction >= 1:
                  return self
  
          decimate = vtk.vtkDecimatePro()
          decimate.SetInputData(poly)
          decimate.SetTargetReduction(1 - fraction)
          decimate.PreserveTopologyOff()
          if boundaries:
              decimate.BoundaryVertexDeletionOff()
          else:
              decimate.BoundaryVertexDeletionOn()
          decimate.Update()
          if verbose:
              print("Nr. of pts, input:", poly.GetNumberOfPoints(), end="")
              print(" output:", decimate.GetOutput().GetNumberOfPoints())
          return self.updateMesh(decimate.GetOutput())
docs: Downsample the number of vertices in a mesh.
  
          :param float fraction: the desired target of reduction.
          :param int N: the desired number of final points (**fraction** is recalculated based on it).
          :param bool boundaries: (True), decide whether to leave boundaries untouched or not.
  
          .. note:: Setting ``fraction=0.1`` leaves 10% of the original nr of vertices.
  
          .. hint:: |skeletonize| |skeletonize.py|_