{ "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", "plot = K3D()\n", "view_matrix = (\n", " (1.0, 0.0, 3.0, -0.5),\n", " (0.0, 1.0, -1.0, 0.0),\n", " (0.0, 0.0, 1.0, 27.5),\n", " (0.0, 0.0, 0.0, 0.0)\n", ")\n", "res = 100\n", "scalars_field = (\n", " round(0.25 * sin(float(x)/res * 2*pi) + 0.25 * cos(float(y)/res * 2*pi), 3) for x in range(res) for y in range(res)\n", ")\n", "plot += K3D.surface(view_matrix, scalars_field, resolution=res)\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 }