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 a boolean intersection operation on two meshes.
  
  Essentially, boolean union, difference, and intersection are
  all the same operation. Just different parts of the objects
  are kept at the end.
  
  The intersection of two manifold meshes ``A`` and ``B`` is the mesh
  which is the volume of ``A`` that is also in ``B``.
  
  .. note::
     If your boolean operations don't react the way you think they
     should (i.e. the wrong parts disappear), one of your meshes
     probably has its normals pointing inward. Use
     :func:`PolyDataFilters.plot_normals` to visualize the
     normals.
  
  .. note::
     This method returns the "volume" intersection between two
     meshes whereas the :func:`PolyDataFilters.intersection`
     filter returns the surface intersection between two meshes
     (which often resolves as a line).
  
  
  .. note::
     Both meshes must be composed of all triangles.  Check with
     :attr:`PolyData.is_all_triangles` and convert with
     :func:`PolyDataFilters.triangulate`.
  
  .. versionadded:: 0.32.0
  
  Parameters
  ----------
  other_mesh : pyvista.PolyData
      Mesh operating on the source mesh.
  
  tolerance : float, default: 1e-5
      Tolerance used to determine when a point's absolute
      distance is considered to be zero.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  Returns
  -------
  pyvista.PolyData
      The result of the boolean operation.
  
  Examples
  --------
  Demonstrate a boolean intersection with two spheres.  Note how
  the final mesh only includes the intersection of the two.
  
  >>> import pyvista as pv
  >>> sphere_a = pv.Sphere()
  >>> sphere_b = pv.Sphere(center=(0.5, 0, 0))
  >>> result = sphere_a.boolean_intersection(sphere_b)
  >>> pl = pv.Plotter()
  >>> _ = pl.add_mesh(
  ...     sphere_a, color='r', style='wireframe', line_width=3
  ... )
  >>> _ = pl.add_mesh(
  ...     sphere_b, color='b', style='wireframe', line_width=3
  ... )
  >>> _ = pl.add_mesh(result, color='lightblue')
  >>> pl.camera_position = 'xz'
  >>> pl.show()
  
  See :ref:`boolean_example` for more examples using this filter.
docstr_tok: ["Perform","a","boolean","intersection","operation","on","two","meshes",".","Essentially",",","boolean","union",",","difference",",","and","intersection","are","all","the","same","operation",".","Just","different","parts","of","the","objects","are","kept","at","the","end",".","The","intersection","of","two","manifold","meshes","``","A","``","and","``","B","``","is","the","mesh","which","is","the","volume","of","``","A","``","that","is","also","in","``","B","``",".","..","note",":",":","If","your","boolean","operations","do","n't","react","the","way","you","think","they","should","(","i.e",".","the","wrong","parts","disappear",")",",","one","of","your","meshes","probably","has","its","normals","pointing","inward",".","Use",":","func",":","`","PolyDataFilters.plot_normals","`","to","visualize","the","normals",".","..","note",":",":","This","method","returns","the","``","volume","''","intersection","between","two","meshes","whereas","the",":","func",":","`","PolyDataFilters.intersection","`","filter","returns","the","surface","intersection","between","two","meshes","(","which","often","resolves","as","a","line",")",".","..","note",":",":","Both","meshes","must","be","composed","of","all","triangles",".","Check","with",":","attr",":","`","PolyData.is_all_triangles","`","and","convert","with",":","func",":","`","PolyDataFilters.triangulate","`",".","..","versionadded",":",":","0.32.0","Parameters","--","--","--","--","--","other_mesh",":","pyvista.PolyData","Mesh","operating","on","the","source","mesh",".","tolerance",":","float",",","default",":","1e-5","Tolerance","used","to","determine","when","a","point","'s","absolute","distance","is","considered","to","be","zero",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","Returns","--","--","--","-","pyvista.PolyData","The","result","of","the","boolean","operation",".","Examples","--","--","--","--","Demonstrate","a","boolean","intersection","with","two","spheres",".","Note","how","the","final","mesh","only","includes","the","intersection","of","the","two",".",">",">",">","import","pyvista","as","pv",">",">",">","sphere_a","=","pv.Sphere","(",")",">",">",">","sphere_b","=","pv.Sphere","(","center=","(","0.5",",","0",",","0",")",")",">",">",">","result","=","sphere_a.boolean_intersection","(","sphere_b",")",">",">",">","pl","=","pv.Plotter","(",")",">",">",">","_","=","pl.add_mesh","(","...","sphere_a",",","color=","'","r","'",",","style='wireframe","'",",","line_width=3","...",")",">",">",">","_","=","pl.add_mesh","(","...","sphere_b",",","color=","'","b","'",",","style='wireframe","'",",","line_width=3","...",")",">",">",">","_","=","pl.add_mesh","(","result",",","color='lightblue","'",")",">",">",">","pl.camera_position","=","'xz'",">",">",">","pl.show","(",")","See",":","ref",":","`","boolean_example","`","for","more","examples","using","this","filter","."]
code: def boolean_intersection(
      self, other_mesh, tolerance=1e-5, progress_bar=False
  ):
      """Perform a boolean intersection operation on two meshes.
  
      Essentially, boolean union, difference, and intersection are
      all the same operation. Just different parts of the objects
      are kept at the end.
  
      The intersection of two manifold meshes ``A`` and ``B`` is the mesh
      which is the volume of ``A`` that is also in ``B``.
  
      .. note::
         If your boolean operations don't react the way you think they
         should (i.e. the wrong parts disappear), one of your meshes
         probably has its normals pointing inward. Use
         :func:`PolyDataFilters.plot_normals` to visualize the
         normals.
  
      .. note::
         This method returns the "volume" intersection between two
         meshes whereas the :func:`PolyDataFilters.intersection`
         filter returns the surface intersection between two meshes
         (which often resolves as a line).
  
  
      .. note::
         Both meshes must be composed of all triangles.  Check with
         :attr:`PolyData.is_all_triangles` and convert with
         :func:`PolyDataFilters.triangulate`.
  
      .. versionadded:: 0.32.0
  
      Parameters
      ----------
      other_mesh : pyvista.PolyData
          Mesh operating on the source mesh.
  
      tolerance : float, default: 1e-5
          Tolerance used to determine when a point's absolute
          distance is considered to be zero.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.PolyData
          The result of the boolean operation.
  
      Examples
      --------
      Demonstrate a boolean intersection with two spheres.  Note how
      the final mesh only includes the intersection of the two.
  
      >>> import pyvista as pv
      >>> sphere_a = pv.Sphere()
      >>> sphere_b = pv.Sphere(center=(0.5, 0, 0))
      >>> result = sphere_a.boolean_intersection(sphere_b)
      >>> pl = pv.Plotter()
      >>> _ = pl.add_mesh(
      ...     sphere_a, color='r', style='wireframe', line_width=3
      ... )
      >>> _ = pl.add_mesh(
      ...     sphere_b, color='b', style='wireframe', line_width=3
      ... )
      >>> _ = pl.add_mesh(result, color='lightblue')
      >>> pl.camera_position = 'xz'
      >>> pl.show()
  
      See :ref:`boolean_example` for more examples using this filter.
  
      """
      bool_inter = self._boolean(
          "intersection",
          other_mesh,
          tolerance,
          progress_bar=progress_bar,
      )
  
      # check if a polydata is completely contained within another
      if bool_inter.n_points == 0:
          inter, s1, s2 = self.intersection(other_mesh)
          if (
              inter.n_points == 0
              and s1.n_points == 0
              and s2.n_points == 0
          ):
              warnings.warn(
                  "Unable to compute boolean intersection when one PolyData is "
                  "contained within another and no faces intersect.",
              )
      return bool_inter
  
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 4 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.boolean_intersection(other_mesh, tolerance, progress_bar) and returns: bool_inter