.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/2_multiscaling/plot_multiscaling.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_auto_examples_2_multiscaling_plot_multiscaling.py: Multiscaling (triangle mesh) ============================ The Multiscale class is used to create a multiscale representation of a triangle mesh using quadric decimation. Quadric decimation reduces the number of points of a mesh by iteratively collapsing the edge with the smallest quadric error. For reference on quadric decimation, see: `Garland and Heckbert 1997 `_. We use the implementation proposed by `fast-simplification `_. .. GENERATED FROM PYTHON SOURCE LINES 16-17 Load a mesh .. GENERATED FROM PYTHON SOURCE LINES 17-25 .. code-block:: Python import pyvista as pv import pyvista.examples import skshapes as sks bunny = sks.PolyData(pyvista.examples.download_bunny()) .. GENERATED FROM PYTHON SOURCE LINES 26-28 Create the multiscale representation with different ratios of the original  number of points .. GENERATED FROM PYTHON SOURCE LINES 28-32 .. code-block:: Python multiscale_bunny = sks.Multiscale(shape=bunny, ratios=[0.1, 0.01, 0.005]) .. GENERATED FROM PYTHON SOURCE LINES 33-34 Visualize the multiscale representation .. GENERATED FROM PYTHON SOURCE LINES 34-53 .. code-block:: Python plotter = pv.Plotter(shape=(1, 4)) plotter.subplot(0, 0) plotter.add_mesh(multiscale_bunny.at(ratio=1).to_pyvista()) plotter.add_text(f"N_points={multiscale_bunny.at(ratio=1).n_points}") plotter.view_xy() plotter.subplot(0, 1) plotter.add_mesh(multiscale_bunny.at(ratio=0.1).to_pyvista()) plotter.add_text(f"N_points={multiscale_bunny.at(ratio=0.1).n_points}") plotter.view_xy() plotter.subplot(0, 2) plotter.add_mesh(multiscale_bunny.at(ratio=0.01).to_pyvista()) plotter.add_text(f"N_points={multiscale_bunny.at(ratio=0.01).n_points}") plotter.view_xy() plotter.subplot(0, 3) plotter.add_mesh(multiscale_bunny.at(ratio=0.005).to_pyvista()) plotter.add_text(f"N_points={multiscale_bunny.at(ratio=0.005).n_points}") plotter.view_xy() plotter.show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /auto_examples/2_multiscaling/images/sphx_glr_plot_multiscaling_001.png :alt: plot multiscaling :srcset: /auto_examples/2_multiscaling/images/sphx_glr_plot_multiscaling_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/runner/work/scikit-shapes/scikit-shapes/doc/source/auto_examples/2_multiscaling/images/sphx_glr_plot_multiscaling_001.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.066 seconds) .. _sphx_glr_download_auto_examples_2_multiscaling_plot_multiscaling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_multiscaling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_multiscaling.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_