|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": null, |
| 5 | + "execution_count": 2, |
6 | 6 | "metadata": {}, |
7 | | - "outputs": [], |
| 7 | + "outputs": [ |
| 8 | + { |
| 9 | + "name": "stdout", |
| 10 | + "output_type": "stream", |
| 11 | + "text": [ |
| 12 | + "\u001b[32;1m_________________________________________________________________\u001b[0m\n", |
| 13 | + "\u001b[2m\u001b[7m\u001b[1m\u001b[32;1mMesh/Points\u001b[0m \n", |
| 14 | + "\u001b[1m\u001b[32;1m name: \u001b[0m\u001b[32;1mSphere\u001b[0m\n", |
| 15 | + "\u001b[1m\u001b[32;1m points: \u001b[0m\u001b[32;1m1058\u001b[0m\n", |
| 16 | + "\u001b[1m\u001b[32;1m cells: \u001b[0m\u001b[32;1m2112\u001b[0m\n", |
| 17 | + "\u001b[1m\u001b[32;1m polygons: \u001b[0m\u001b[32;1m2112\u001b[0m\n", |
| 18 | + "\u001b[1m\u001b[32;1m position: \u001b[0m\u001b[32;1m(0.0, 0.0, 0.0)\u001b[0m\n", |
| 19 | + "\u001b[1m\u001b[32;1m scale: \u001b[0m\u001b[32;1m(1.00, 1.00, 1.00)\u001b[0m\n", |
| 20 | + "\u001b[1m\u001b[32;1m center of mass: \u001b[0m\u001b[32;1m(0, 0, 0)\u001b[0m\n", |
| 21 | + "\u001b[1m\u001b[32;1m average size: \u001b[0m\u001b[32;1m1.00000\u001b[0m\n", |
| 22 | + "\u001b[1m\u001b[32;1m diagonal size: \u001b[0m\u001b[32;1m3.45872\u001b[0m\n", |
| 23 | + "\u001b[1m\u001b[32;1m bounds: \u001b[0m\u001b[32;1mx=(-0.998, 0.998)\u001b[0m\u001b[32;1m y=(-0.998, 0.998)\u001b[0m\u001b[32;1m z=(-1.00, 1.00)\u001b[0m\n", |
| 24 | + "\u001b[1m\u001b[32;1m scalar mode:\u001b[0m \u001b[32;1mDefault coloring = Default\u001b[0m\n", |
| 25 | + "\u001b[1m\u001b[32;1m active array: \u001b[0m\u001b[32;1mDistance (point data) \u001b[0m\n", |
| 26 | + "\u001b[1m\u001b[32;1m point data: \u001b[0m\u001b[32;1mname=Normals (3 FLOAT, np.float32),\u001b[0m\u001b[32;1m range=(-0.998,0.998)\u001b[0m\n", |
| 27 | + "\u001b[1m\u001b[32;1m point data: \u001b[0m\u001b[32;1mname=Distance (1 DOUBLE, np.float64),\u001b[0m\u001b[32;1m range=(1.50,3.50)\u001b[0m\n", |
| 28 | + "[2.54950976 2.54950976 2.41422468 ... 2.14595456 2.27999987 2.41536531]\n" |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + "data": { |
| 33 | + "application/vnd.jupyter.widget-view+json": { |
| 34 | + "model_id": "b796eb2c20d146398cdebb41c8ac8dae", |
| 35 | + "version_major": 2, |
| 36 | + "version_minor": 0 |
| 37 | + }, |
| 38 | + "text/plain": [ |
| 39 | + "ViewInteractiveWidget(height=960, layout=Layout(height='auto', width='100%'), width=960)" |
| 40 | + ] |
| 41 | + }, |
| 42 | + "metadata": {}, |
| 43 | + "output_type": "display_data" |
| 44 | + } |
| 45 | + ], |
8 | 46 | "source": [ |
9 | 47 | "\"\"\"Compute the (signed) distance from one mesh to another.\"\"\"\n", |
10 | 48 | "\n", |
11 | 49 | "from vedo import *\n", |
12 | 50 | "\n", |
13 | 51 | "s1 = Sphere().flat() # flat shading\n", |
14 | | - "s2 = Cube(pos=(1,0,0), c='white', alpha=0.2)\n", |
| 52 | + "s2 = Cube(pos=(3,0,0), c='white', alpha=0.2)\n", |
15 | 53 | "\n", |
16 | 54 | "# add scalars to the sphere that correspond to their distance from the cube\n", |
17 | | - "s1.distanceTo(s2, signed=True, invert=False)\n", |
| 55 | + "s1.distanceTo(s2, signed=True, invert=False).addScalarBar()\n", |
18 | 56 | "\n", |
19 | | - "#s1.printInfo()\n", |
20 | | - "#print(s1.getPointArray(\"Distance\"))\n", |
| 57 | + "s1.print()\n", |
| 58 | + "print(s1.pointdata[\"Distance\"])\n", |
21 | 59 | "\n", |
22 | 60 | "plt = show(s1, s2, viewup='z', axes=1, backend='ipyvtk')\n", |
23 | 61 | "plt" |
24 | 62 | ] |
25 | 63 | }, |
26 | 64 | { |
27 | 65 | "cell_type": "code", |
28 | | - "execution_count": null, |
| 66 | + "execution_count": 3, |
29 | 67 | "metadata": {}, |
30 | 68 | "outputs": [], |
31 | 69 | "source": [ |
32 | 70 | "plt.close()" |
33 | 71 | ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "code", |
| 75 | + "execution_count": null, |
| 76 | + "metadata": {}, |
| 77 | + "outputs": [], |
| 78 | + "source": [] |
34 | 79 | } |
35 | 80 | ], |
36 | 81 | "metadata": { |
37 | 82 | "kernelspec": { |
38 | | - "display_name": "Python 3", |
| 83 | + "display_name": "Python 3 (ipykernel)", |
39 | 84 | "language": "python", |
40 | 85 | "name": "python3" |
41 | 86 | }, |
|
49 | 94 | "name": "python", |
50 | 95 | "nbconvert_exporter": "python", |
51 | 96 | "pygments_lexer": "ipython3", |
52 | | - "version": "3.8.8" |
| 97 | + "version": "3.9.7" |
53 | 98 | } |
54 | 99 | }, |
55 | 100 | "nbformat": 4, |
|
0 commit comments