{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from k3d import K3D\n", "import numpy\n", "from math import sin, cos, pi\n", "\n", "view_matrix = (\n", " 10.0, 2.0, -20.0, 0.0,\n", " 0.0, 10.0, 0.0, 5.0,\n", " 0.0, 0.0, 10.0, 0.0,\n", " 0.0, 0.0, 0.0, 1.0\n", ")\n", "width = height = 100\n", "scalars_field = []\n", "\n", "for x in range(width):\n", " for y in range(height):\n", " scalars_field.append(round(0.25 * sin(float(x)/width * 2*pi) + 0.25 * cos(float(y)/height * 2*pi), 3))\n", "\n", "plot = K3D()\n", "plot += K3D.surface(scalars_field, width, height, view_matrix, color=0xFF0000)\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 }