@@ -0,0 +1,1239 @@
+%22%22%22%0AComputing Surface Normals%0A~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A%0ACompute normals on a surface.%0A%22%22%22%0A################################################################################%0A# Computing the normals of a surace is quite easy using :class:%60vtki.PolyData%60's%0A# %60%60compute_normals%60%60 method%0A%0A# sphinx_gallery_thumbnail_number = 2%0Aimport vtki%0Afrom vtki import examples%0A%0Amesh = examples.download_topo_global()%0Amesh.plot(cmap='gist_earth', show_scalar_bar=False)%0A%0A################################################################################%0A# Now we have a surface dataset of the globe loaded - unfortunately, the dataset%0A# shows the globe with a uniform radius which hides topographic releif.%0A# Using :func:%60vtki.PolyData.compute_normals%60, we can compute the normal vectors%0A# on the globe at all points in the dataset, then use the values given in the%0A# dataset to warp the surface in the normals direction to create some%0A# exaggerated topographic relief.%0A%0A# Compute the normals in-place and use them to warp the globe%0Amesh.compute_normals() # this activates the normals as well%0A%0A# Now use those normals to warp the surface%0Awarp = mesh.warp_by_scalar(scale_factor=0.5e-5)%0A%0A# And let's see it!%0Awarp.plot(cmap='gist_earth', show_scalar_bar=False)%0A

Add surface normals example