######################
Axis Triad and Navcube
######################

Both the NavCube and the Axis Triad are prebuilt tools that help with scene navigation that are drawn in an overlay layer. For more info on overlays, see the :doc:`Overlays Programming Guide </prog_guide/viewing/scene_attributes/overlays>`.

.. image:: images/axis_triad_nav_cube_main.png


Axis triad
==========

.. image:: images/axis_triad_nav_cube_triad.png

The axis triad is a visualization of the X, Y and Z axis orientation. The axis geometry is drawn in an overlay. Selecting an axis will rotate the scene to orient it along the selected axis. This is controlled by the :js:class:`~wv.Operators.AxisTriadOperator`.


NavCube
=======

.. image:: images/axis_triad_nav_cube_cube.png

The :js:class:`~wv.NavCube` is a visualization of the scene orientation. The cube geometry is drawn in an overlay. The :js:class:`~wv.NavCube` is divided into sections that highlight as the mouse hovers over. Selecting the :js:class:`~wv.NavCube` will rotate the scene to orient it along with a specified view corresponding to the selected section. This is controlled by the :js:class:`~wv.Operators.NavCubeOperator`.

By default, the model up vector is preserved when navigating with the :js:class:`~wv.NavCube`. The result is that the :js:class:`~wv.NavCube` will remain upright at all times. You can change this behavior by passing ``false`` to :js:meth:`~wv.NavCube.setPreserveModelUp`. The result is that the :js:class:`~wv.NavCube` will roll over smoothly and ignore the model up vector.


Modifying the axis triad
========================

The :js:class:`~wv.AxisTriad` class provides an interface to enable or disable, set the anchor position, and change the axis colors for the axis triad. For example, the following snippet changes the axis triad X axis to yellow, and positions the axis triad in the center of the screen.

.. literalinclude:: /../../applications/client/docs/PG_Viewing_axistriad_navcube.ts
   :start-after: //! [axistriad_color_position]
   :end-before: //! [axistriad_color_position]

.. image:: images/axis_triad_nav_cube_modifying.png


Modifying the NavCube
=====================

The :js:class:`~wv.NavCube` class provides an interface to enable / disable, and set the anchor position of the :js:class:`~wv.NavCube`. For example, the following snippet positions the axis triad in the center of the screen.

.. literalinclude:: /../../applications/client/docs/PG_Viewing_axistriad_navcube.ts
   :start-after: //! [navcube_position]
   :end-before: //! [navcube_position]
