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: Compute the intersection between two meshes.
  
  .. note::
     This method returns the surface intersection from two meshes
     (which often resolves as a line), whereas the
     :func:`PolyDataFilters.boolean_intersection` filter returns
     the "volume" intersection between two closed (manifold)
     meshes.
  
  Parameters
  ----------
  mesh : pyvista.PolyData
      The mesh to intersect with.
  
  split_first : bool, default: True
      If ``True``, return the first input mesh split by the
      intersection with the second input mesh.
  
  split_second : bool, default: True
      If ``True``, return the second input mesh split by the
      intersection with the first input mesh.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  Returns
  -------
  pyvista.PolyData
      The intersection line.
  
  pyvista.PolyData
      The first mesh split along the intersection. Returns the
      original first mesh if ``split_first=False``.
  
  pyvista.PolyData
      The second mesh split along the intersection. Returns the
      original second mesh if ``split_second=False``.
  
  Examples
  --------
  Intersect two spheres, returning the intersection and both spheres
  which have new points/cells along the intersection line.
  
  >>> import pyvista as pv
  >>> import numpy as np
  >>> s1 = pv.Sphere(phi_resolution=15, theta_resolution=15)
  >>> s2 = s1.copy()
  >>> s2.points += np.array([0.25, 0, 0])
  >>> intersection, s1_split, s2_split = s1.intersection(s2)
  >>> pl = pv.Plotter()
  >>> _ = pl.add_mesh(s1, style='wireframe')
  >>> _ = pl.add_mesh(s2, style='wireframe')
  >>> _ = pl.add_mesh(intersection, color='r', line_width=10)
  >>> pl.show()
  
  The mesh splitting takes additional time and can be turned
  off for either mesh individually.
  
  >>> intersection, _, s2_split = s1.intersection(
  ...     s2, split_first=False, split_second=True
  ... )
docstr_tok: ["Compute","the","intersection","between","two","meshes",".","..","note",":",":","This","method","returns","the","surface","intersection","from","two","meshes","(","which","often","resolves","as","a","line",")",",","whereas","the",":","func",":","`","PolyDataFilters.boolean_intersection","`","filter","returns","the","``","volume","''","intersection","between","two","closed","(","manifold",")","meshes",".","Parameters","--","--","--","--","--","mesh",":","pyvista.PolyData","The","mesh","to","intersect","with",".","split_first",":","bool",",","default",":","True","If","``","True","``",",","return","the","first","input","mesh","split","by","the","intersection","with","the","second","input","mesh",".","split_second",":","bool",",","default",":","True","If","``","True","``",",","return","the","second","input","mesh","split","by","the","intersection","with","the","first","input","mesh",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","Returns","--","--","--","-","pyvista.PolyData","The","intersection","line",".","pyvista.PolyData","The","first","mesh","split","along","the","intersection",".","Returns","the","original","first","mesh","if","``","split_first=False","``",".","pyvista.PolyData","The","second","mesh","split","along","the","intersection",".","Returns","the","original","second","mesh","if","``","split_second=False","``",".","Examples","--","--","--","--","Intersect","two","spheres",",","returning","the","intersection","and","both","spheres","which","have","new","points\/cells","along","the","intersection","line",".",">",">",">","import","pyvista","as","pv",">",">",">","import","numpy","as","np",">",">",">","s1","=","pv.Sphere","(","phi_resolution=15",",","theta_resolution=15",")",">",">",">","s2","=","s1.copy","(",")",">",">",">","s2.points","+=","np.array","(","[","0.25",",","0",",","0","]",")",">",">",">","intersection",",","s1_split",",","s2_split","=","s1.intersection","(","s2",")",">",">",">","pl","=","pv.Plotter","(",")",">",">",">","_","=","pl.add_mesh","(","s1",",","style='wireframe","'",")",">",">",">","_","=","pl.add_mesh","(","s2",",","style='wireframe","'",")",">",">",">","_","=","pl.add_mesh","(","intersection",",","color=","'","r","'",",","line_width=10",")",">",">",">","pl.show","(",")","The","mesh","splitting","takes","additional","time","and","can","be","turned","off","for","either","mesh","individually",".",">",">",">","intersection",",","_",",","s2_split","=","s1.intersection","(","...","s2",",","split_first=False",",","split_second=True","...",")"]
code: def intersection(
      self,
      mesh,
      split_first=True,
      split_second=True,
      progress_bar=False,
  ):
      """Compute the intersection between two meshes.
  
      .. note::
         This method returns the surface intersection from two meshes
         (which often resolves as a line), whereas the
         :func:`PolyDataFilters.boolean_intersection` filter returns
         the "volume" intersection between two closed (manifold)
         meshes.
  
      Parameters
      ----------
      mesh : pyvista.PolyData
          The mesh to intersect with.
  
      split_first : bool, default: True
          If ``True``, return the first input mesh split by the
          intersection with the second input mesh.
  
      split_second : bool, default: True
          If ``True``, return the second input mesh split by the
          intersection with the first input mesh.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.PolyData
          The intersection line.
  
      pyvista.PolyData
          The first mesh split along the intersection. Returns the
          original first mesh if ``split_first=False``.
  
      pyvista.PolyData
          The second mesh split along the intersection. Returns the
          original second mesh if ``split_second=False``.
  
      Examples
      --------
      Intersect two spheres, returning the intersection and both spheres
      which have new points/cells along the intersection line.
  
      >>> import pyvista as pv
      >>> import numpy as np
      >>> s1 = pv.Sphere(phi_resolution=15, theta_resolution=15)
      >>> s2 = s1.copy()
      >>> s2.points += np.array([0.25, 0, 0])
      >>> intersection, s1_split, s2_split = s1.intersection(s2)
      >>> pl = pv.Plotter()
      >>> _ = pl.add_mesh(s1, style='wireframe')
      >>> _ = pl.add_mesh(s2, style='wireframe')
      >>> _ = pl.add_mesh(intersection, color='r', line_width=10)
      >>> pl.show()
  
      The mesh splitting takes additional time and can be turned
      off for either mesh individually.
  
      >>> intersection, _, s2_split = s1.intersection(
      ...     s2, split_first=False, split_second=True
      ... )
  
      """
      intfilter = _vtk.vtkIntersectionPolyDataFilter()
      intfilter.SetInputDataObject(0, self)
      intfilter.SetInputDataObject(1, mesh)
      intfilter.SetComputeIntersectionPointArray(True)
      intfilter.SetSplitFirstOutput(split_first)
      intfilter.SetSplitSecondOutput(split_second)
      _update_alg(
          intfilter,
          progress_bar,
          "Computing the intersection between two meshes",
      )
  
      intersection = _get_output(intfilter, oport=0)
      first = _get_output(intfilter, oport=1)
      second = _get_output(intfilter, oport=2)
  
      return intersection, first, second
  
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 10 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.intersection(mesh, split_first, split_second, progress_bar) and returns: intersection,  first,  second