
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/04_observer_mixin/p03_los_and_fov_views.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_04_observer_mixin_p03_los_and_fov_views.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_04_observer_mixin_p03_los_and_fov_views.py:


Line-of-Sight and Field-of-View Control
=========================================

This example demonstrates the two complementary APIs for aiming and framing the
observer's camera in helioprojective coordinates:

- :attr:`~pyvisual.core.mixins.ObserverMixin.observer_los_view` — sets the
  field of view as explicit angular extents :math:`(x_0, x_1, y_0, y_1)` in
  degrees, measured from Sun-center along the observer's line of sight.
- :attr:`~pyvisual.core.mixins.ObserverMixin.observer_fov_view` — sets the
  (square) field of view by specifying the minimum impact radius
  :math:`r_{\min}` (in :math:`R_\odot`) that any line of sight must clear.

Both properties require :attr:`~pyvisual.core.mixins.ObserverMixin.observer_position`
to be set first, because the focal-point calculation depends on the observer
distance.

.. GENERATED FROM PYTHON SOURCE LINES 19-23

.. code-block:: Python


    import numpy as np
    from pyvisual import Plot3d








.. GENERATED FROM PYTHON SOURCE LINES 24-38

LOS View — Asymmetric Field of View
-------------------------------------

:attr:`~pyvisual.core.mixins.ObserverMixin.observer_los_view` accepts a
4-tuple ``(x0, x1, y0, y1)`` of helioprojective angular extents in degrees.
Here the observer sits at :math:`r = 50\,R_\odot` on the equatorial plane
and looks back at the Sun with a wide horizontal sweep
(:math:`-15°` to :math:`+15°`) and a narrower vertical window
(:math:`-8°` to :math:`+8°`), placing the viewport aspect ratio at
:math:`30/16 \approx 1.875`.

The focal point is automatically computed from the center of the angular
range via the Thomson sphere, so the camera always aims along the correct
helioprojective direction.

.. GENERATED FROM PYTHON SOURCE LINES 38-47

.. code-block:: Python


    plotter = Plot3d()
    plotter.add_sun()
    plotter.add_shell(inner_radius=2.0, outer_radius=2.0, opacity=0.15, color='cyan')
    plotter.add_shell(inner_radius=6.0, outer_radius=6.0, opacity=0.10, color='orange')
    plotter.observer_position = 50, np.pi / 2, 0
    plotter.observer_los_view = -15, 15, -8, 8
    plotter.show()








.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_001.png
        :alt: p03 los and fov views
        :srcset: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_001.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /Users/rdavidson/MHDweb/pyvisual/docs/source/gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_001.vtksz






.. GENERATED FROM PYTHON SOURCE LINES 48-55

LOS View — Off-Center Pointing
--------------------------------

Shifting the angular range off-center moves the focal point away from
Sun-center.  Here the horizontal window is displaced by :math:`+5°`
(``x0 = -5``, ``x1 = +15``) so that the camera is biased to the east
limb of the Sun.  The vertical extent remains symmetric.

.. GENERATED FROM PYTHON SOURCE LINES 55-63

.. code-block:: Python


    plotter = Plot3d()
    plotter.add_sun()
    plotter.add_shell(inner_radius=2.0, outer_radius=2.0, opacity=0.15, color='cyan')
    plotter.observer_position = 50, np.pi / 2, 0
    plotter.observer_los_view = -5, 15, -8, 8
    plotter.show()








.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_002.png
        :alt: p03 los and fov views
        :srcset: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_002.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /Users/rdavidson/MHDweb/pyvisual/docs/source/gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_002.vtksz






.. GENERATED FROM PYTHON SOURCE LINES 64-75

FOV View — Impact-Parameter Framing
-------------------------------------

:attr:`~pyvisual.core.mixins.ObserverMixin.observer_fov_view` is a
higher-level alternative.  Instead of raw angles, you supply a single scalar
:math:`r_{\min}`.

The result is a square viewport whose edge lines of sight just graze the
sphere of radius :math:`r_{\min}` around Sun-center.  Setting
:math:`r_{\min} = 1\,R_\odot` frames the entire solar disc with minimal
margin; larger values show the extended corona.

.. GENERATED FROM PYTHON SOURCE LINES 75-83

.. code-block:: Python


    plotter = Plot3d()
    plotter.add_sun()
    plotter.add_shell(inner_radius=2.5, outer_radius=2.5, opacity=0.15, color='cyan')
    plotter.observer_position = 50, np.pi / 2, 0
    plotter.observer_fov_view = 4
    plotter.show()








.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_003.png
        :alt: p03 los and fov views
        :srcset: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_003.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /Users/rdavidson/MHDweb/pyvisual/docs/source/gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_003.vtksz






.. GENERATED FROM PYTHON SOURCE LINES 84-95

Comparing Impact Radii
-----------------------

The same observer position is used at three different impact radii to
illustrate how a smaller :math:`r_{\min}` zooms in on the solar disc
while a larger one opens the view out to the extended corona.

.. note::
   The observer distance is fixed at :math:`50\,R_\odot` throughout.
   Changing :math:`r_{\min}` only rescales the angular FOV; it does not
   move the camera.

.. GENERATED FROM PYTHON SOURCE LINES 95-102

.. code-block:: Python


    for rmin in (1.5, 4.0, 10.0):
        plotter = Plot3d()
        plotter.add_sun()
        plotter.add_shell(inner_radius=rmin, outer_radius=rmin, opacity=0.2, color='yellow')
        plotter.observer_position = 50, np.pi / 2, 0
        plotter.observer_fov_view = rmin
        plotter.show()






.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_004.png
        :alt: p03 los and fov views
        :srcset: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_004.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /Users/rdavidson/MHDweb/pyvisual/docs/source/gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_004.vtksz






.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_005.png
        :alt: p03 los and fov views
        :srcset: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_005.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /Users/rdavidson/MHDweb/pyvisual/docs/source/gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_005.vtksz






.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_006.png
        :alt: p03 los and fov views
        :srcset: /gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_006.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /Users/rdavidson/MHDweb/pyvisual/docs/source/gallery/04_observer_mixin/images/sphx_glr_p03_los_and_fov_views_006.vtksz







.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 8.603 seconds)


.. _sphx_glr_download_gallery_04_observer_mixin_p03_los_and_fov_views.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: p03_los_and_fov_views.ipynb <p03_los_and_fov_views.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: p03_los_and_fov_views.py <p03_los_and_fov_views.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: p03_los_and_fov_views.zip <p03_los_and_fov_views.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
