{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Platonic" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5164da31e55b48908997f8f853c98aeb", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import k3d\n", "import k3d.platonic as platonic\n", "import math\n", "\n", "plot = k3d.plot(camera_auto_fit=False)\n", "\n", "meshes = [\n", " platonic.Dodecahedron().mesh,\n", " platonic.Cube().mesh,\n", " platonic.Icosahedron().mesh,\n", " platonic.Octahedron().mesh,\n", " platonic.Tetrahedron().mesh\n", "]\n", "\n", "colors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff]\n", "\n", "for i, obj in enumerate(meshes): \n", " rad = math.radians(i / len(meshes) * 360)\n", " radius = 3.5\n", " obj.transform.translation = [math.sin(rad) * radius, math.cos(rad) * radius, 0]\n", " obj.color = colors[i]\n", " plot += obj\n", "\n", "plot.display()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.8" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }