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 union 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 union of two manifold meshes ``A`` and ``B`` is the mesh
  which is in ``A``, in ``B``, or in both ``A`` and ``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::
     The behavior of this filter varies from the
     :func:`PolyDataFilters.merge` filter.  This filter attempts
     to create a manifold mesh and will not include internal
     surfaces when two meshes overlap.
  
  .. note::
     Both meshes must be composed of all triangles.  Check with
     :attr:`PolyData.is_all_triangles` and convert with
     :func:`PolyDataFilters.triangulate`.
  
  .. versionchanged:: 0.32.0
     Behavior changed to match default VTK behavior.
  
  Parameters
  ----------
  other_mesh : pyvista.PolyData
      Mesh operating on the source mesh.
  
  tolerance : float, tolerance: 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 union with two spheres.  Note how the
  final mesh includes both spheres.
  
  >>> import pyvista as pv
  >>> sphere_a = pv.Sphere()
  >>> sphere_b = pv.Sphere(center=(0.5, 0, 0))
  >>> result = sphere_a.boolean_union(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","union","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","union","of","two","manifold","meshes","``","A","``","and","``","B","``","is","the","mesh","which","is","in","``","A","``",",","in","``","B","``",",","or","in","both","``","A","``","and","``","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",":",":","The","behavior","of","this","filter","varies","from","the",":","func",":","`","PolyDataFilters.merge","`","filter",".","This","filter","attempts","to","create","a","manifold","mesh","and","will","not","include","internal","surfaces","when","two","meshes","overlap",".","..","note",":",":","Both","meshes","must","be","composed","of","all","triangles",".","Check","with",":","attr",":","`","PolyData.is_all_triangles","`","and","convert","with",":","func",":","`","PolyDataFilters.triangulate","`",".","..","versionchanged",":",":","0.32.0","Behavior","changed","to","match","default","VTK","behavior",".","Parameters","--","--","--","--","--","other_mesh",":","pyvista.PolyData","Mesh","operating","on","the","source","mesh",".","tolerance",":","float",",","tolerance",":","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","union","with","two","spheres",".","Note","how","the","final","mesh","includes","both","spheres",".",">",">",">","import","pyvista","as","pv",">",">",">","sphere_a","=","pv.Sphere","(",")",">",">",">","sphere_b","=","pv.Sphere","(","center=","(","0.5",",","0",",","0",")",")",">",">",">","result","=","sphere_a.boolean_union","(","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_union(
      self, other_mesh, tolerance=1e-5, progress_bar=False
  ):
      """Perform a boolean union 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 union of two manifold meshes ``A`` and ``B`` is the mesh
      which is in ``A``, in ``B``, or in both ``A`` and ``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::
         The behavior of this filter varies from the
         :func:`PolyDataFilters.merge` filter.  This filter attempts
         to create a manifold mesh and will not include internal
         surfaces when two meshes overlap.
  
      .. note::
         Both meshes must be composed of all triangles.  Check with
         :attr:`PolyData.is_all_triangles` and convert with
         :func:`PolyDataFilters.triangulate`.
  
      .. versionchanged:: 0.32.0
         Behavior changed to match default VTK behavior.
  
      Parameters
      ----------
      other_mesh : pyvista.PolyData
          Mesh operating on the source mesh.
  
      tolerance : float, tolerance: 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 union with two spheres.  Note how the
      final mesh includes both spheres.
  
      >>> import pyvista as pv
      >>> sphere_a = pv.Sphere()
      >>> sphere_b = pv.Sphere(center=(0.5, 0, 0))
      >>> result = sphere_a.boolean_union(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.
  
      """
      return self._boolean(
          "union", other_mesh, tolerance, progress_bar=progress_bar
      )
  
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 3 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.boolean_union(other_mesh, tolerance, progress_bar) and returns: self