Beispiel #1
0
def init_planet(filename):
    """Initialize a planet actor.

    Parameters
    ----------
    filename : str
        The filename for the corresponding planet texture.

    Returns
    -------
    planet_actor: actor
        The corresponding sphere actor with texture applied.
    """
    planet_file = read_viz_textures(filename)
    planet_image = io.load_image(planet_file)
    planet_actor = actor.texture_on_sphere(planet_image)
    scene.add(planet_actor)
    return planet_actor
Beispiel #2
0
def init_planet(planet_data):
    """Initialize a planet actor.

    Parameters
    ----------
    planet_data : dict
        The planet_data is a dictionary, and the keys are filename(texture),
        position and scale.

    Returns
    -------
    planet_actor: actor
        The corresponding sphere actor with texture applied.
    """
    planet_file = read_viz_textures(planet_data['filename'])
    planet_image = io.load_image(planet_file)
    planet_actor = actor.texture_on_sphere(planet_image)
    planet_actor.SetPosition(planet_data['position'], 0, 0)
    planet_actor.SetScale(planet_data['scale'])
    scene.add(planet_actor)
    return planet_actor
Beispiel #3
0
from fury import window, actor, utils, primitive, io
from fury.data import read_viz_textures, fetch_viz_textures

##############################################################################
# Create a scene to start.

scene = window.Scene()

##############################################################################
# Load an image (png, bmp, jpeg or jpg) using ``io.load_image``. In this
# example, we will use ``read_viz_textures`` to access an image of the
# Earth's surface from the fury Github after using ''fetch_viz_textures()''
# to download the available textures.

fetch_viz_textures()
filename = read_viz_textures("1_earth_8k.jpg")
image = io.load_image(filename)

##############################################################################
# Next, use ``actor.texture_on_sphere`` to add a sphere with the texture from
# your loaded image to the already existing scene.
# To add a texture to your scene as visualized on a plane, use
# ``actor.texture`` instead.

scene.add(actor.texture_on_sphere(image))

##############################################################################
# Lastly, record the scene, or set interactive to True if you would like to
# manipulate your new sphere.

interactive = False
Beispiel #4
0
from fury.data import read_viz_models, fetch_viz_models

##############################################################################
# Create a scene to start.

scene = window.Scene()

##############################################################################
# Next, load in a texture for each of the actors. For this tutorial, we will
# be creating one textured sphere for the Earth, and another for the moon.
# Collect the Earth texture from the FURY github using ``fetch_viz_textures``
# and  ``read_viz_textures``, then use ``io.load_image`` to load in the
# image.

fetch_viz_textures()
earth_filename = read_viz_textures("1_earth_8k.jpg")
earth_image = io.load_image(earth_filename)

##############################################################################
# Using ``actor.texture_on_sphere()``, create an earth_actor with your newly
# loaded texture.

earth_actor = actor.texture_on_sphere(earth_image)

##############################################################################
# Then, do the same for the moon.

moon_filename = read_viz_textures("moon-8k.jpg")
moon_image = io.load_image(moon_filename)

moon_actor = actor.texture_on_sphere(moon_image)
Beispiel #5
0
from fury import window, actor, utils, primitive, io
from fury.data import read_viz_textures, fetch_viz_textures

##############################################################################
# Create a scene to start.

scene = window.Scene()

##############################################################################
# Load an image (png, bmp, jpeg or jpg) using ``io.load_image``. In this
# example, we will use ``read_viz_textures`` to access an image of the
# Earth's surface from the fury Github after using ''fetch_viz_textures()''
# to download the available textures.

fetch_viz_textures()
filename = read_viz_textures("Yellow_Cell.png")
image = io.load_image(filename)

##############################################################################
# Next, use ``actor.texture_on_sphere`` to add a sphere with the texture from
# your loaded image to the already existing scene.
# To add a texture to your scene as visualized on a plane, use
# ``actor.texture`` instead.

scene.add(actor.texture_on_sphere(image))

##############################################################################
# Lastly, record the scene, or set interactive to True if you would like to
# manipulate your new sphere.

interactive = True
Beispiel #6
0
from fury import window, actor, utils, io
from fury.data import read_viz_textures, fetch_viz_textures
import math
import numpy as np
import itertools

###############################################################################
# Create a new scene, and load in the image of the Earth using
# ``fetch_viz_textures`` and ``read_viz_textures``. We will use a 16k
# resolution texture for maximum detail.

scene = window.Scene()

fetch_viz_textures()
earth_file = read_viz_textures("1_earth_16k.jpg")
earth_image = io.load_image(earth_file)
earth_actor = actor.texture_on_sphere(earth_image)
scene.add(earth_actor)

###############################################################################
# Rotate the Earth to make sure the texture is correctly oriented. Change it's
# scale using ``actor.SetScale()``.

utils.rotate(earth_actor, (-90, 1, 0, 0))
utils.rotate(earth_actor, (180, 0, 1, 0))
earth_actor.SetScale(2, 2, 2)

###############################################################################
# Define the function to convert geographical coordinates of a location in
# latitude and longitude degrees to coordinates on the ``earth_actor`` surface.