.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/01_introductory/viz_cone.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

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

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

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

.. _sphx_glr_auto_examples_01_introductory_viz_cone.py:


======================================================================
Fury Cone Actor
======================================================================
This example shows how to use the cone actor.

.. GENERATED FROM PYTHON SOURCE LINES 7-12

.. code-block:: Python


    import numpy as np

    from fury import actor, window








.. GENERATED FROM PYTHON SOURCE LINES 13-14

First thing, you have to specify centers, directions, and colors of the cone

.. GENERATED FROM PYTHON SOURCE LINES 14-19

.. code-block:: Python


    centers = np.zeros([3, 3])
    dirs = np.identity(3)
    colors = np.identity(3)








.. GENERATED FROM PYTHON SOURCE LINES 20-21

The below cone actor is generated by repeating the cone primitive.

.. GENERATED FROM PYTHON SOURCE LINES 21-24

.. code-block:: Python


    cone_actor1 = actor.cone(centers, dirs, colors=colors, heights=1.5)








.. GENERATED FROM PYTHON SOURCE LINES 25-27

repeating what we did but this time with random directions, and colors
Here, we're using vtkConeSource to generate the cone actor

.. GENERATED FROM PYTHON SOURCE LINES 27-36

.. code-block:: Python


    cen2 = np.add(centers, np.array([3, 0, 0]))
    dir2 = np.random.rand(5, 3)
    cols2 = np.random.rand(5, 3)

    cone_actor2 = actor.cone(cen2, dir2, colors=cols2, heights=1.5, use_primitive=False)

    scene = window.Scene()








.. GENERATED FROM PYTHON SOURCE LINES 37-38

Adding our cone actors to scene.

.. GENERATED FROM PYTHON SOURCE LINES 38-48

.. code-block:: Python


    scene.add(cone_actor1)
    scene.add(cone_actor2)

    interactive = False

    if interactive:
        window.show(scene, size=(600, 600))

    window.record(scene=scene, out_path="viz_cone.png", size=(600, 600))



.. image-sg:: /auto_examples/01_introductory/images/sphx_glr_viz_cone_001.png
   :alt: viz cone
   :srcset: /auto_examples/01_introductory/images/sphx_glr_viz_cone_001.png
   :class: sphx-glr-single-img






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

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


.. _sphx_glr_download_auto_examples_01_introductory_viz_cone.py:

.. only:: html

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

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

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

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

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


.. only:: html

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

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