import k3d
import math
import numpy as np
def generate(a, b, c, d, N=1000):
points = np.zeros(N * 3, dtype=np.float32)
x = y = z = 0
for i in range(N):
xn = math.sin(a * y) + c * math.cos(a * x)
yn = math.sin(b * x) + d * math.cos(b * y)
zn = math.sin(1.4 * (x + z))
points[i * 3] = xn
points[i * 3 + 1] = yn
points[i * 3 + 2] = zn
x = xn
y = yn
z = zn
return points
plot = k3d.plot()
for idx in range(5):
p = generate(1.5 + idx * 0.1, -1.8, 1.6, 0.9)
g = "Variant %d" % (idx + 1)
plot += k3d.points(p, point_size=0.05, name='points', color=k3d.nice_colors[idx], group=g)
plot += k3d.line(p, name='trajectory', color=k3d.nice_colors[idx], group=g)
plot.display()
plot.objects[0].name = 'abc'
plot.objects[0].group = 'Test'
plot.objects[1].group = 'Test'
# back to without group mode
plot.objects[0].group = None
plot.objects[1].group = None