.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_introductory/viz_arrow.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_introductory_viz_arrow.py: ====================================================================== Fury Arrow Actor ====================================================================== This example shows how to use the arrow actor. .. GENERATED FROM PYTHON SOURCE LINES 8-13 .. code-block:: Python import numpy as np from fury import actor, window .. GENERATED FROM PYTHON SOURCE LINES 14-16 First thing, you have to specify centers, directions, and colors of the arrow(s) .. GENERATED FROM PYTHON SOURCE LINES 16-19 .. code-block:: Python centers = np.zeros([3, 3]) .. GENERATED FROM PYTHON SOURCE LINES 20-21 np.identity is the same as specifying x, y, and z directions. .. GENERATED FROM PYTHON SOURCE LINES 21-25 .. code-block:: Python dirs = np.identity(3) colors = np.identity(3) scales = np.array([2.1, 2.6, 2.5]) .. GENERATED FROM PYTHON SOURCE LINES 26-27 The below arrow actor is generated by repeating the arrow primitive. .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: Python arrow_actor = actor.arrow(centers, dirs, colors=colors, scales=1.5) .. GENERATED FROM PYTHON SOURCE LINES 31-33 repeating what we did but this time with random centers, directions, and colors. .. GENERATED FROM PYTHON SOURCE LINES 33-42 .. code-block:: Python cen2 = np.random.rand(5, 3) dir2 = np.random.rand(5, 3) cols2 = np.random.rand(5, 3) arrow_actor2 = actor.arrow(cen2, dir2, colors=cols2, scales=1.5) scene = window.Scene() .. GENERATED FROM PYTHON SOURCE LINES 43-44 Adding our Arrow actors to scene. .. GENERATED FROM PYTHON SOURCE LINES 44-54 .. code-block:: Python scene.add(arrow_actor) scene.add(arrow_actor2) interactive = False if interactive: window.show(scene, size=(600, 600)) window.record(scene, out_path='viz_arrow.png', size=(600, 600)) .. image-sg:: /auto_examples/01_introductory/images/sphx_glr_viz_arrow_001.png :alt: viz arrow :srcset: /auto_examples/01_introductory/images/sphx_glr_viz_arrow_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.052 seconds) .. _sphx_glr_download_auto_examples_01_introductory_viz_arrow.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_arrow.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_arrow.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_