import k3d
import k3d.platonic as platonic
import math
import numpy as np
def test(plot):
colors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff]
for j in range(5):
meshes = [
platonic.Dodecahedron().mesh,
platonic.Cube().mesh,
platonic.Icosahedron().mesh,
platonic.Octahedron().mesh,
platonic.Tetrahedron().mesh
]
for i, obj in enumerate(meshes):
rad = math.radians(i / len(meshes) * 360)
radius = 3.5
obj.transform.translation = [math.sin(rad) * radius, math.cos(rad) * radius, 2*j]
obj.color = colors[i]
plot += obj
plot.render()
plot = k3d.plot()
plot.display()
Output()
plot.auto_rendering = True
test(plot)
while plot.objects:
plot -= plot.objects[-1]
plot.render()
plot.auto_rendering = False
while len(plot.objects)>2:
plot -= plot.objects[-1]
plot.render()
import numpy as np
for i in range(10):
plot += k3d.points(np.random.randn(1,3))#,color=0xff0000)
plot.camera = [-0.9639876204909027,
-23.61169267956684,
i,
0,
0.334220290184021,
4,
0.007512009764659415,
0.3054834418666324,
0.9521677564665881]
plot.render()
for i in range(100):
plot.camera = [940.698323963372,
-1632.233209973555,
i*10,
4.949999809265137,
-490.04998779296875,
49.005001068115234,
0.008397615690103343,
0.012813759314055312,
0.9998826369244359]