.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorial/02_mesh/a_lesson_mesh.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 or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorial_02_mesh_a_lesson_mesh.py: Lesson Overview ~~~~~~~~~~~~~~~ This exercise provides an overview of the example in the initial lesson for you to try out! .. GENERATED FROM PYTHON SOURCE LINES 9-14 .. code-block:: Python import numpy as np import pyvista as pv from pyvista import examples .. GENERATED FROM PYTHON SOURCE LINES 16-21 What is a Point? ^^^^^^^^^^^^^^^^ Let’s start with a point cloud – this is a mesh type that only has vertices. You can create one by defining a 2D array of Cartesian coordinates like so: .. GENERATED FROM PYTHON SOURCE LINES 21-25 .. code-block:: Python points = np.random.rand(100, 3) points[:5, :] # output first 5 rows .. rst-class:: sphx-glr-script-out .. code-block:: none array([[0.83829407, 0.99855226, 0.33382294], [0.09984125, 0.6991538 , 0.7008512 ], [0.1551016 , 0.65602537, 0.9485784 ], [0.45442426, 0.13233035, 0.10335398], [0.5608671 , 0.28436427, 0.48968647]]) .. GENERATED FROM PYTHON SOURCE LINES 26-27 Pass numpy array of points (n by 3) to PolyData .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: Python mesh = pv.PolyData(points) mesh .. raw:: html
PolyDataInformation
N Cells100
N Points100
N Strips0
X Bounds2.932e-03, 9.965e-01
Y Bounds2.092e-03, 9.986e-01
Z Bounds9.208e-04, 9.970e-01
N Arrays0