.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/01_introductory/viz_sphere.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_sphere.py>`
        to download the full example code

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

.. _sphx_glr_auto_examples_01_introductory_viz_sphere.py:


======================================================================
FURY sphere Actor
======================================================================
This example shows how to use both primitive and vtkSource sphere actor.

.. GENERATED FROM PYTHON SOURCE LINES 7-12

.. code-block:: Python


    import numpy as np

    import fury








.. GENERATED FROM PYTHON SOURCE LINES 13-14

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

.. GENERATED FROM PYTHON SOURCE LINES 14-18

.. code-block:: Python


    centers = np.zeros([1, 3])
    colors = np.array([0, 0, 1])








.. GENERATED FROM PYTHON SOURCE LINES 19-20

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

.. GENERATED FROM PYTHON SOURCE LINES 20-23

.. code-block:: Python


    prim_sphere_actor = fury.actor.sphere(centers, colors=colors, radii=5)








.. GENERATED FROM PYTHON SOURCE LINES 24-25

This time, we're using vtkSphereSource to generate the sphere actor

.. GENERATED FROM PYTHON SOURCE LINES 25-33

.. code-block:: Python


    cen2 = np.add(centers, np.array([12, 0, 0]))
    cols2 = np.array([1, 0, 0])

    vtk_sphere_actor = fury.actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False)

    scene = fury.window.Scene()








.. GENERATED FROM PYTHON SOURCE LINES 34-35

Adding our sphere actors to scene.

.. GENERATED FROM PYTHON SOURCE LINES 35-45

.. code-block:: Python


    scene.add(prim_sphere_actor)
    scene.add(vtk_sphere_actor)

    interactive = False

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

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



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






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

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


.. _sphx_glr_download_auto_examples_01_introductory_viz_sphere.py:

.. only:: html

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

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

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

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

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


.. only:: html

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

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