{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Group objects" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "22fffb982a8b473682fec2d9c95010d9", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import k3d\n", "\n", "positions=[[0,0,0], [0,1,3], [2,2,1]]\n", "\n", "group = k3d.points(positions, point_size=0.2, shader='mesh') + \\\n", " k3d.line(positions, shader='mesh', width=0.05)\n", "group " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b7bf62b6375d4599b62794b4c84ced30", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "group + k3d.mesh(positions, [0,1,2], color=0xff70ca)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.6.5" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "22fffb982a8b473682fec2d9c95010d9": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "layout": "IPY_MODEL_8220d35de0b7462ab1535eb1b1d1ac50", "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3b6e48fcbf194e36b9090c1377eb0f30", "version_major": 2, "version_minor": 0 }, "text/plain": "Plot(antialias=3, axes=['x', 'y', 'z'], background_color=16777215, camera=[4.5, 4.5, 4.5, 0.0, 0.0, 0.0, 1.0, …" }, "metadata": {}, "output_type": "display_data" } ] } }, "3b6e48fcbf194e36b9090c1377eb0f30": { "model_module": "k3d", "model_module_version": "2.6.7", "model_name": "PlotModel", "state": { "_backend_version": "2.6.7", "_dom_classes": [], "_view_count": null, "antialias": 3, "axes": [ "x", "y", "z" ], "background_color": 16777215, "camera": [ 4.7078924280066055, -4.561838642009908, 1.8707892428006638, 1, 1, 1.5, 0, 0, 1 ], "camera_auto_fit": true, "camera_no_pan": false, "camera_no_rotate": false, "camera_no_zoom": false, "clipping_planes": [], "colorbar_object_id": -1, "fps_meter": false, "grid": [ -1, -1, -1, 1, 1, 1 ], "grid_auto_fit": true, "grid_visible": true, "height": 512, "layout": "IPY_MODEL_5f83af0983e4420ba8bad0db155437cc", "lighting": 1, "menu_visibility": true, "object_ids": [ 1946552008096, 1946823381680 ], "rendering_steps": 1, "screenshot": "", "screenshot_scale": 2, "time": 0, "voxel_paint_color": 0 } }, "3f525de0cfb24a7db96627089bcd8748": { "buffers": [ { "data": "", "encoding": "base64", "path": [ "attribute", "buffer" ] }, { "data": "", "encoding": "base64", "path": [ "color_map", "buffer" ] }, { "data": "AAAAAAEAAAACAAAA", "encoding": "base64", "path": [ "indices", "buffer" ] }, { "data": "AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPw==", "encoding": "base64", "path": [ "model_matrix", "buffer" ] }, { "data": "AAAAAAAAAAAAAAAAAAAAAAAAgD8AAEBAAAAAQAAAAEAAAIA/", "encoding": "base64", "path": [ "vertices", "buffer" ] } ], "model_module": "k3d", "model_module_version": "2.6.7", "model_name": "ObjectModel", "state": { "_view_count": null, "_view_module": null, "_view_module_version": "", "_view_name": null, "attribute": { "dtype": "float32", "shape": [ 0 ] }, "color": 16740554, "color_map": { "dtype": "float32", "shape": [ 0 ] }, "color_range": [], "compression_level": 0, "flat_shading": true, "id": 1946552005632, "indices": { "dtype": "uint32", "shape": [ 3 ] }, "model_matrix": { "dtype": "float32", "shape": [ 4, 4 ] }, "name": null, "opacity": 1, "type": "Mesh", "vertices": { "dtype": "float32", "shape": [ 3, 3 ] }, "visible": true, "wireframe": false } }, "5f83af0983e4420ba8bad0db155437cc": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.0.0", "model_name": "LayoutModel", "state": {} }, "6c1eda355f334b81901d662c88c995c0": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.0.0", "model_name": "LayoutModel", "state": {} }, "80730525a9fa45ddb6a7435b7b3f3aaf": { "buffers": [ { "data": "", "encoding": "base64", "path": [ "colors", "buffer" ] }, { "data": "AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPw==", "encoding": "base64", "path": [ "model_matrix", "buffer" ] }, { "data": "AAAAAAAAAAAAAAAAAAAAAAAAgD8AAEBAAAAAQAAAAEAAAIA/", "encoding": "base64", "path": [ "positions", "buffer" ] } ], "model_module": "k3d", "model_module_version": "2.6.7", "model_name": "ObjectModel", "state": { "_view_count": null, "_view_module": null, "_view_module_version": "", "_view_name": null, "color": 255, "colors": { "dtype": "uint32", "shape": [ 0 ] }, "compression_level": 0, "id": 1946552008096, "mesh_detail": 2, "model_matrix": { "dtype": "float32", "shape": [ 4, 4 ] }, "name": null, "opacity": 1, "point_size": 0.2, "positions": { "dtype": "float32", "shape": [ 3, 3 ] }, "shader": "mesh", "type": "Points", "visible": true } }, "8220d35de0b7462ab1535eb1b1d1ac50": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.0.0", "model_name": "LayoutModel", "state": {} }, "b7bf62b6375d4599b62794b4c84ced30": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "layout": "IPY_MODEL_cec83cd9350f4c2d931c320fff48b37c", "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c68d522ccbea4db3ab8f9cc875dca7df", "version_major": 2, "version_minor": 0 }, "text/plain": "Plot(antialias=3, axes=['x', 'y', 'z'], background_color=16777215, camera=[4.5, 4.5, 4.5, 0.0, 0.0, 0.0, 1.0, …" }, "metadata": {}, "output_type": "display_data" } ] } }, "c68d522ccbea4db3ab8f9cc875dca7df": { "model_module": "k3d", "model_module_version": "2.6.7", "model_name": "PlotModel", "state": { "_backend_version": "2.6.7", "_dom_classes": [], "_view_count": null, "antialias": 3, "axes": [ "x", "y", "z" ], "background_color": 16777215, "camera": [ 4.7078924280066055, -4.561838642009908, 1.8707892428006638, 1, 1, 1.5, 0, 0, 1 ], "camera_auto_fit": true, "camera_no_pan": false, "camera_no_rotate": false, "camera_no_zoom": false, "clipping_planes": [], "colorbar_object_id": -1, "fps_meter": false, "grid": [ -1, -1, -1, 1, 1, 1 ], "grid_auto_fit": true, "grid_visible": true, "height": 512, "layout": "IPY_MODEL_6c1eda355f334b81901d662c88c995c0", "lighting": 1, "menu_visibility": true, "object_ids": [ 1946552008096, 1946823381680, 1946552005632 ], "rendering_steps": 1, "screenshot": "", "screenshot_scale": 2, "time": 0, "voxel_paint_color": 0 } }, "cec83cd9350f4c2d931c320fff48b37c": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.0.0", "model_name": "LayoutModel", "state": {} }, "d602aa3f6fe747fe9279976e90cdf1a6": { "buffers": [ { "data": "", "encoding": "base64", "path": [ "attribute", "buffer" ] }, { "data": "", "encoding": "base64", "path": [ "color_map", "buffer" ] }, { "data": "", "encoding": "base64", "path": [ "colors", "buffer" ] }, { "data": "AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPw==", "encoding": "base64", "path": [ "model_matrix", "buffer" ] }, { "data": "AAAAAAAAAAAAAAAAAAAAAAAAgD8AAEBAAAAAQAAAAEAAAIA/", "encoding": "base64", "path": [ "vertices", "buffer" ] } ], "model_module": "k3d", "model_module_version": "2.6.7", "model_name": "ObjectModel", "state": { "_view_count": null, "_view_module": null, "_view_module_version": "", "_view_name": null, "attribute": { "dtype": "float32", "shape": [ 0 ] }, "color": 255, "color_map": { "dtype": "float32", "shape": [ 0 ] }, "color_range": [], "colors": { "dtype": "uint32", "shape": [ 0 ] }, "compression_level": 0, "id": 1946823381680, "model_matrix": { "dtype": "float32", "shape": [ 4, 4 ] }, "name": null, "radial_segments": 8, "shader": "mesh", "type": "Line", "vertices": { "dtype": "float32", "shape": [ 3, 3 ] }, "visible": true, "width": 0.05 } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 2 }