{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Basics of vedo" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from vedo import *\n", "\n", "settings.default_backend = \"vtk\" # or k3d, ipyvtk, trame, or 2d" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Show an empty window (press q to close it)\n", "plt = Plotter()\n", "plt.show()\n", "plt.close()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "
\n", "\n", "
\n", " Sphere:   vedo.mesh.Mesh\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
bounds
(x/y/z)
-0.9977 ... 0.9977
-0.9977 ... 0.9977
-1.000 ... 1.000
center of mass (0, 0, 0)
average size 1.000
nr. points / faces 1058 / 2112
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sphere = Sphere().linewidth(1)\n", "sphere" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "plt = Plotter()\n", "plt += sphere\n", "plt.show()\n", "plt.close()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# We can add multiple objects:\n", "plt = Plotter()\n", "\n", "# Add a sphere\n", "sphere = Sphere(r=1.5).c(\"red\", 0.2)\n", "\n", "# Add a box\n", "box = Box(pos=(1, 0, 0)).triangulate().c(\"green\", 0.2) \n", "\n", "# We can get its intersection\n", "intersection = sphere.intersect_with(box).linewidth(4).c(\"black\")\n", "\n", "plt += sphere\n", "plt += box\n", "plt += intersection\n", "\n", "plt.show()\n", "plt.close()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.10" } }, "nbformat": 4, "nbformat_minor": 2 }