Skip to content

Sphere texturing #257

Description

@harkness526

I'm trying to plot mesh with Earth texture, but as a result, I got a shphere with a strange color. I suppose that problem with u and v, but I don't know how to fix it.
image

import PIL.Image
import numpy as np
import ipyvolume as ipv
image = PIL.Image.open('2k_earth_daymap.jpg')
R = 12742
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)

x = R * np.outer(np.cos(u), np.sin(v))
y = R * np.outer(np.sin(u), np.sin(v))
z = R * np.outer(np.ones(np.size(u)), np.cos(v))

# u = np.array([x/5 +np.sin(k/8*np.pi)*4. for k in range(8)])
# v = np.array([-y/5*(1-k/7.) + z*(k/7.) for k in range(8)])
ipv.figure()
ipv.plot_mesh(x, z, y,u=y, v=x,wireframe=False,texture = image)  #texture = image
# earth.texture = PIL.Image.open('2k_earth_daymap.jpg')
ipv.show() 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions