from k3d import K3D
from math import sin, cos, pi
vectors = []
colors = []
width = height = 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 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)))
colors.append((1, 0, 0, 1, 1, 1))
plot = K3D(background_color=0)
plot += K3D.vector2d(vectors, colors, width, height, view_matrix, use_head=False)
plot.display()