.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/bunny.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_bunny.py: Bunny ----- Repair the holes in the bunny mesh. .. GENERATED FROM PYTHON SOURCE LINES 7-14 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 import pyvista as pv from pyvista import examples import pymeshfix as mf .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python bunny = examples.download_bunny() # Define a camera position that shows the holes in the mesh cpos = [(-0.2, -0.13, 0.12), (-0.015, 0.10, -0.0), (0.28, 0.26, 0.9)] # Show mesh bunny.plot(cpos=cpos) .. image-sg:: /examples/images/sphx_glr_bunny_001.png :alt: bunny :srcset: /examples/images/sphx_glr_bunny_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 24-25 Generate a meshfix mesh ready for fixing and extract the holes .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: Python meshfix = mf.MeshFix(bunny) holes = meshfix.extract_holes() .. GENERATED FROM PYTHON SOURCE LINES 29-30 Render the mesh and outline the holes .. GENERATED FROM PYTHON SOURCE LINES 30-37 .. code-block:: Python p = pv.Plotter() p.add_mesh(bunny, color=True) p.add_mesh(holes, color="r", line_width=8) p.camera_position = cpos p.enable_eye_dome_lighting() # helps depth perception p.show() .. image-sg:: /examples/images/sphx_glr_bunny_002.png :alt: bunny :srcset: /examples/images/sphx_glr_bunny_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 38-39 Repair the mesh .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: Python meshfix.repair(verbose=True) .. rst-class:: sphx-glr-script-out .. code-block:: none Patching holes... Patched 5 holes Fixing degeneracies and intersections .. GENERATED FROM PYTHON SOURCE LINES 42-43 Show the repaired mesh .. GENERATED FROM PYTHON SOURCE LINES 43-44 .. code-block:: Python meshfix.mesh.plot(cpos=cpos) .. image-sg:: /examples/images/sphx_glr_bunny_003.png :alt: bunny :srcset: /examples/images/sphx_glr_bunny_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.843 seconds) .. _sphx_glr_download_examples_bunny.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: bunny.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: bunny.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_