{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from k3d import K3D\n", "from math import sin, cos, pi\n", "\n", "vectors = []\n", "colors = []\n", "width = height = 20\n", "view_matrix = (\n", " 7.0, 5.0, -5.0, 0.0,\n", " 0.0, 7.0, 7.0, 5.0,\n", " 7.0, -5.0, 5.0, 0.0,\n", " 0.0, 0.0, 0.0, 1.0\n", ")\n", "\n", "for y in range(height):\n", " for x in range(width):\n", " vectors.append(((sin(float(x) / width * pi * 2.0)), cos(float(y) / height * pi * 2.0)))\n", " colors.append((1, 0, 0, 1, 1, 1))\n", "\n", "plot = K3D(background_color=0)\n", "plot += K3D.vector2d(vectors, colors, width, height, view_matrix, use_head=False)\n", "plot.display()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }