
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/polygon_with_hole.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_polygon_with_hole.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_polygon_with_hole.py:


Polygon with hole geometry example
----------------------------------

Polygon with hole geometry example.

.. GENERATED FROM PYTHON SOURCE LINES 8-18

.. code-block:: Python



    from __future__ import annotations

    import skgmsh as sg

    shell = [(0, 0, 0), (0, 10, 0), (10, 10, 0), (10, 0, 0), (0, 0, 0)]
    holes = [[(2, 2, 0), (2, 4, 0), (4, 4, 0), (4, 2, 0), (2, 2, 0)]]
    alg = sg.Delaunay2D(shell=shell, holes=holes)








.. GENERATED FROM PYTHON SOURCE LINES 20-21

Generate the mesh.

.. GENERATED FROM PYTHON SOURCE LINES 21-24

.. code-block:: Python


    alg.mesh.plot(show_edges=True, cpos="xy", color="white", line_width=2)








.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /examples/images/sphx_glr_polygon_with_hole_001.png
        :alt: polygon with hole
        :srcset: /examples/images/sphx_glr_polygon_with_hole_001.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/scikit-gmsh/checkouts/latest/docs/examples/images/sphx_glr_polygon_with_hole_001.vtksz






.. GENERATED FROM PYTHON SOURCE LINES 25-26

Change the cell size of the mesh.

.. GENERATED FROM PYTHON SOURCE LINES 26-30

.. code-block:: Python


    alg.cell_size = 2.0
    alg.mesh.plot(show_edges=True, cpos="xy", color="white", line_width=2)








.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /examples/images/sphx_glr_polygon_with_hole_002.png
        :alt: polygon with hole
        :srcset: /examples/images/sphx_glr_polygon_with_hole_002.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/scikit-gmsh/checkouts/latest/docs/examples/images/sphx_glr_polygon_with_hole_002.vtksz






.. GENERATED FROM PYTHON SOURCE LINES 31-32

Enable recombine.

.. GENERATED FROM PYTHON SOURCE LINES 32-35

.. code-block:: Python


    alg.enable_recombine()
    alg.mesh.plot(show_edges=True, cpos="xy", color="white", line_width=2)







.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /examples/images/sphx_glr_polygon_with_hole_003.png
        :alt: polygon with hole
        :srcset: /examples/images/sphx_glr_polygon_with_hole_003.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/scikit-gmsh/checkouts/latest/docs/examples/images/sphx_glr_polygon_with_hole_003.vtksz







.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.398 seconds)


.. _sphx_glr_download_examples_polygon_with_hole.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: polygon_with_hole.ipynb <polygon_with_hole.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: polygon_with_hole.py <polygon_with_hole.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: polygon_with_hole.zip <polygon_with_hole.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
