class_docstr: An internal class to manage filters/algorithms for polydata datasets.
class_docstr_tok: ["An","internal","class","to","manage","filters\/algorithms","for","polydata","datasets","."]
docstr: Perform boolean operation.
docstr_tok: ["Perform","boolean","operation","."]
code: def _boolean(self, btype, other_mesh, tolerance, progress_bar=False):
      """Perform boolean operation."""
      if self.n_points == other_mesh.n_points:
          if np.allclose(self.points, other_mesh.points):
              raise ValueError(
                  "The input mesh contains identical points to the surface being operated on. Unable to perform boolean operations on an identical surface."
              )
      if not isinstance(other_mesh, pyvista.PolyData):
          raise TypeError("Input mesh must be PolyData.")
      if not self.is_all_triangles or not other_mesh.is_all_triangles:
          raise NotAllTrianglesError(
              "Make sure both the input and output are triangulated."
          )
  
      bfilter = _vtk.vtkBooleanOperationPolyDataFilter()
      if btype == "union":
          bfilter.SetOperationToUnion()
      elif btype == "intersection":
          bfilter.SetOperationToIntersection()
      elif btype == "difference":
          bfilter.SetOperationToDifference()
      else:  # pragma: no cover
          raise ValueError(f"Invalid btype {btype}")
      bfilter.SetInputData(0, self)
      bfilter.SetInputData(1, other_mesh)
      bfilter.ReorientDifferenceCellsOn()  # this is already default
      bfilter.SetTolerance(tolerance)
      _update_alg(bfilter, progress_bar, "Performing Boolean Operation")
  
      return _get_output(bfilter)
  
imports: import collections.abc
  import warnings
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core.errors import MissingDataError, NotAllTrianglesError, PyVistaFutureWarning, VTKVersionError
  from pyvista.core.filters import _get_output, _update_alg
  from pyvista.core.filters.data_set import DataSetFilters
  from pyvista.core.utilities.arrays import FieldAssociation, get_array, get_array_association, set_default_active_scalars, vtk_id_list_to_array
  from pyvista.core.utilities.geometric_objects import NORMALS
  from pyvista.core.utilities.helpers import generate_plane, wrap
  from pyvista.core.utilities.misc import abstract_class, assert_empty_kwargs
label_desc: Use image node_id 2 for calling the PolyDataFilters obj's underlying member method code with example usage: obj._boolean(btype, other_mesh, tolerance, progress_bar) and returns: _get_output