{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Orbiting {#orbiting_example}\n\nOrbit around a scene.\n\n::: note\n::: title\nNote\n:::\n\nThe quality of the movie will be better when using\n`p.open_movie('orbit.mp4')` instead of `p.open_gif('orbit.gif')`\n:::\n\nFor orbiting to work you first have to show the scene and leave the\nplotter open with `.show(auto_close=False)`. You may also have to set\n`pv.Plotter(off_screen=True)`\n\n::: note\n::: title\nNote\n:::\n\nUse `lighting=False` to reduce the size of the color space to avoid\n\\\"jittery\\\" GIFs when showing the scalar bar.\n:::\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import pyvista as pv\nfrom pyvista import examples\n\nmesh = examples.download_st_helens().warp_by_scalar()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Orbit around the Mt. St Helens dataset.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "p = pv.Plotter()\np.add_mesh(mesh, lighting=False)\np.camera.zoom(1.5)\np.show(auto_close=False)\npath = p.generate_orbital_path(n_points=36, shift=mesh.length)\np.open_gif(\"orbit.gif\")\np.orbit_on_path(path, write_frames=True)\np.close()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "p = pv.Plotter()\np.add_mesh(mesh, lighting=False)\np.show_grid()\np.show(auto_close=False)\nviewup = [0.5, 0.5, 1]\npath = p.generate_orbital_path(factor=2.0, shift=10000, viewup=viewup, n_points=36)\np.open_gif(\"orbit.gif\")\np.orbit_on_path(path, write_frames=True, viewup=[0, 0, 1], step=0.05)\np.close()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "mesh = examples.download_dragon()\nviewup = [0, 1, 0]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "p = pv.Plotter()\np.add_mesh(mesh)\np.show(auto_close=False)\npath = p.generate_orbital_path(factor=2.0, n_points=36, viewup=viewup, shift=0.2)\np.open_gif(\"orbit.gif\")\np.orbit_on_path(path, write_frames=True, viewup=viewup, step=0.05)\np.close()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}