Drawing a sphere
See original GitHub issueThis is partly an issue and partly a question. (I didn’t see anywhere else to ask questions.)
I would like to draw a set of points on the surface of a sphere. I tried this code, using a k3d.points with a large point size to draw the sphere:
import numpy as np
import k3d
points = np.random.standard_normal((1000,3))
points = points / np.linalg.norm(points,axis=1)[:,None]
plot = k3d.plot()
plot += k3d.points([0, 0, 0],point_size = 2,color=0xeeeeee)
plot += k3d.points(points, point_size=0.01,color=0x000000)
plot.display()
However, this doesn’t seem to work very well. If I zoom out the black points get absorbed inside the white sphere, while if I zoom in they seem to be above its surface.
This might be a bug, so I’m reporting it here, but it also might be that k3d.points isn’t supposed to be used this way.
If setting point_size this big isn’t supported, is there a canonical way to draw a sphere in k3d? Triangulating my own mesh seems like overkill, given that some perfectly nice sphere generating code exists already in k3d_points, so I’m wondering if there’s another way to do it.
Issue Analytics
- State:
- Created a year ago
- Comments:6

Top Related StackOverflow Question
Please download new version of k3d@2.14.0:
https://pypi.org/project/k3d/
So preparation of new k3d is here https://github.com/K3D-tools/K3D-jupyter/pull/351