from k3d import K3D
from math import sin, cos, pi
vectors = []
colors = []
width = height = length = 20
view_matrix = (
7.0, 5.0, -5.0, 0.0,
0.0, 7.0, 7.0, 5.0,
7.0, -5.0, 5.0, 0.0,
0.0, 0.0, 0.0, 1.0
)
for z in range(length):
for y in range(height):
for x in range(width):
vectors.append(
(sin(float(x) / width * pi * 2.0), cos(float(y) / height * pi * 2.0), sin(float(z) / length * pi * 2.0))
)
colors.append((1, 0, 0, 1, 1, 1))
plot = K3D(background_color=0x000000)
plot += K3D.vector3d(vectors, colors, width, height, length, view_matrix)
plot.display()