コード例 #1
0
ファイル: background_image.py プロジェクト: yetisir/pyvista
earth_alt = examples.download_topo_global()

pl = pv.Plotter()
actor = pl.add_mesh(examples.load_airplane(), smooth_shading=True)
# pl.add_background_image(examples.mapfile)
pl.plot()

###############################################################################
# Plot several earth related plots

pl = pv.Plotter(shape=(2, 2))

pl.subplot(0, 0)
pl.add_text('Earth Visible as Map')
pl.add_background_image(examples.mapfile, as_global=False)

pl.subplot(0, 1)
pl.add_text('Earth Altitude')
actor = pl.add_mesh(earth_alt, cmap='gist_earth')

pl.subplot(1, 0)
topo = examples.download_topo_land()
actor = pl.add_mesh(topo, cmap='gist_earth')
pl.add_text('Earth Land Altitude')

pl.subplot(1, 1)
pl.add_text('Earth Visible as Globe')
pl.add_mesh(examples.load_globe(), smooth_shading=True)

pl.show()
コード例 #2
0
"""
.. _geodesic_example:

Geodesic Paths
~~~~~~~~~~~~~~

Calculates the geodesic path between two vertices using Dijkstra's algorithm
"""
# sphinx_gallery_thumbnail_number = 1
import pyvista as pv
from pyvista import examples

# Load a global topography surface and decimate it
land = examples.download_topo_land().triangulate().decimate(0.98)

###############################################################################
# Get the geodesic path as a new :class:`pyvista.PolyData` object:
cape_town = land.find_closest_point((0.790801, 0.264598, -0.551942))
dubai = land.find_closest_point((0.512642, 0.745898, 0.425255))
bangkok = land.find_closest_point((-0.177077, 0.955419, 0.236273))
rome = land.find_closest_point((0.718047, 0.163038, 0.676684))

a = land.geodesic(cape_town, dubai)
b = land.geodesic(cape_town, bangkok)
c = land.geodesic(cape_town, rome)

###############################################################################
# Render the path along the land surface

p = pv.Plotter(notebook=0)
p.add_mesh(a + b + c, line_width=10, color="red", label="Geodesic Path")