# Examples from pyvista.Plotter.export_gltf
# =========================================

# Output a simple point cloud represented as balls.
import numpy as np
import pyvista as pv
rng = np.random.default_rng(seed=0)
point_cloud = rng.random((100, 3))
pdata = pv.PolyData(point_cloud)
pdata['orig_sphere'] = np.arange(100)
sphere = pv.Sphere(radius=0.02)
pc = pdata.glyph(scale=False, geom=sphere, orient=False)
pl = pv.Plotter()
_ = pl.add_mesh(
    pc,
    cmap='reds',
    smooth_shading=True,
    show_scalar_bar=False,
)
pl.export_gltf('balls.gltf')
pl.show()

# Output the orientation plotter.
from pyvista import demos
pl = demos.orientation_plotter()
pl.export_gltf('orientation_plotter.gltf')
pl.show()

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

