.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/torso.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_torso.py: Torso ----- Repair the torso mesh where it was extracted and subtle holes along complex parts of the mesh .. GENERATED FROM PYTHON SOURCE LINES 8-18 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 import pyvista as pv from pyvista import examples import pymeshfix as mf mesh = examples.download_torso() print(mesh) .. rst-class:: sphx-glr-script-out .. code-block:: none PolyData (0x7fd5474073a0) N Cells: 12448 N Points: 12015 N Strips: 0 X Bounds: -1.680e+02, 1.720e+02 Y Bounds: -1.624e+02, 1.320e+02 Z Bounds: -6.442e+02, 9.083e+01 N Arrays: 0 .. GENERATED FROM PYTHON SOURCE LINES 19-24 .. code-block:: Python cpos = [(-1053.0, -1251.0, 83.0), (2.0, -15.0, -276.0), (0.12, 0.18, 1)] mesh.plot(color=True, show_edges=True, cpos=cpos) .. image-sg:: /examples/images/sphx_glr_torso_001.png :alt: torso :srcset: /examples/images/sphx_glr_torso_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 25-26 Apply a triangle filter to ensure the mesh is simply polyhedral .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: Python meshfix = mf.MeshFix(mesh.triangulate()) holes = meshfix.extract_holes() .. GENERATED FROM PYTHON SOURCE LINES 30-31 Outline the holes in the mesh .. GENERATED FROM PYTHON SOURCE LINES 31-38 .. code-block:: Python p = pv.Plotter() p.add_mesh(mesh) p.add_mesh(holes, color="r", line_width=8) p.enable_eye_dome_lighting() # helps with depth perception p.camera_position = cpos p.show() .. image-sg:: /examples/images/sphx_glr_torso_002.png :alt: torso :srcset: /examples/images/sphx_glr_torso_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 39-41 Emphasize the hole near the ear - this needs to be repaired so that the mesh is absolutely water tight. .. GENERATED FROM PYTHON SOURCE LINES 41-50 .. code-block:: Python cpos_ear = [(180.0, -206.0, 17.0), (107.0, -122.9, -11.9), (-0.13, 0.22, 0.96)] p = pv.Plotter() p.add_mesh(mesh) p.add_mesh(holes, color="r", line_width=8) p.enable_eye_dome_lighting() # helps with depth perception p.camera_position = cpos_ear p.show() .. image-sg:: /examples/images/sphx_glr_torso_003.png :alt: torso :srcset: /examples/images/sphx_glr_torso_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 51-52 Perform the mesh repair .. GENERATED FROM PYTHON SOURCE LINES 52-54 .. code-block:: Python meshfix.repair(verbose=True) .. rst-class:: sphx-glr-script-out .. code-block:: none Removed 6 small components Patching holes... Patched 5 holes Fixing degeneracies and intersections .. GENERATED FROM PYTHON SOURCE LINES 55-56 Show the repaired mesh .. GENERATED FROM PYTHON SOURCE LINES 56-57 .. code-block:: Python meshfix.mesh.plot(cpos=cpos, eye_dome_lighting=True) .. image-sg:: /examples/images/sphx_glr_torso_004.png :alt: torso :srcset: /examples/images/sphx_glr_torso_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.217 seconds) .. _sphx_glr_download_examples_torso.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: torso.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: torso.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_