Skip to content

Commit 374e191

Browse files
committed
Finish incomplete example
1 parent d72ff2f commit 374e191

File tree

1 file changed

+120
-30
lines changed

1 file changed

+120
-30
lines changed

examples/GeometryVertices.ipynb

Lines changed: 120 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,31 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
6-
"metadata": {
7-
"collapsed": false
8-
},
5+
"execution_count": 1,
6+
"metadata": {},
97
"outputs": [],
108
"source": [
119
"from pythreejs import *\n",
1210
"from IPython.display import display\n",
13-
"from math import pi"
11+
"from math import pi\n",
12+
"import numpy as np"
1413
]
1514
},
1615
{
1716
"cell_type": "code",
18-
"execution_count": null,
19-
"metadata": {
20-
"collapsed": true
21-
},
17+
"execution_count": 2,
18+
"metadata": {},
2219
"outputs": [],
2320
"source": [
2421
"# This test examines the inner workings of the Geometry classes\n",
2522
"# Geometries should be creatable via the helper extras/Geometries classes\n",
26-
"# as well as procedurally creating the vertices yourself\n",
27-
"\n",
28-
"# TODO: INCOMPLETE"
23+
"# as well as procedurally creating the vertices yourself"
2924
]
3025
},
3126
{
3227
"cell_type": "code",
33-
"execution_count": null,
34-
"metadata": {
35-
"collapsed": true
36-
},
28+
"execution_count": 3,
29+
"metadata": {},
3730
"outputs": [],
3831
"source": [
3932
"g = BoxGeometry(\n",
@@ -47,44 +40,141 @@
4740
},
4841
{
4942
"cell_type": "code",
50-
"execution_count": null,
51-
"metadata": {
52-
"collapsed": false
53-
},
43+
"execution_count": 4,
44+
"metadata": {},
45+
"outputs": [
46+
{
47+
"data": {
48+
"application/vnd.jupyter.widget-view+json": {
49+
"model_id": "06a7d577b9ac4be3b901e5aae1282ee3",
50+
"version_major": "2",
51+
"version_minor": "0"
52+
},
53+
"text/plain": [
54+
"A Jupyter Widget"
55+
]
56+
},
57+
"metadata": {},
58+
"output_type": "display_data"
59+
}
60+
],
61+
"source": [
62+
"g"
63+
]
64+
},
65+
{
66+
"cell_type": "code",
67+
"execution_count": 5,
68+
"metadata": {},
5469
"outputs": [],
5570
"source": [
56-
"g.vertices"
71+
"g2 = PlainGeometry.from_geometry(g)"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 6,
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"data": {
81+
"text/plain": [
82+
"((552, 3), 1100)"
83+
]
84+
},
85+
"execution_count": 6,
86+
"metadata": {},
87+
"output_type": "execute_result"
88+
}
89+
],
90+
"source": [
91+
"np.shape(g2.vertices), len(g2.faces)"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": 7,
97+
"metadata": {},
98+
"outputs": [
99+
{
100+
"data": {
101+
"application/vnd.jupyter.widget-view+json": {
102+
"model_id": "5dce7fa2aecc4259a3821e3b44cc1241",
103+
"version_major": "2",
104+
"version_minor": "0"
105+
},
106+
"text/plain": [
107+
"A Jupyter Widget"
108+
]
109+
},
110+
"metadata": {},
111+
"output_type": "display_data"
112+
}
113+
],
114+
"source": [
115+
"g2"
116+
]
117+
},
118+
{
119+
"cell_type": "code",
120+
"execution_count": 8,
121+
"metadata": {},
122+
"outputs": [],
123+
"source": [
124+
"g3 = PlainGeometry(vertices=g2.vertices[:], faces=g2.faces[:])"
125+
]
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": 9,
130+
"metadata": {},
131+
"outputs": [
132+
{
133+
"data": {
134+
"application/vnd.jupyter.widget-view+json": {
135+
"model_id": "2a9e2d0af751490884208fd65ea61e09",
136+
"version_major": "2",
137+
"version_minor": "0"
138+
},
139+
"text/plain": [
140+
"A Jupyter Widget"
141+
]
142+
},
143+
"metadata": {},
144+
"output_type": "display_data"
145+
}
146+
],
147+
"source": [
148+
"g3"
57149
]
58150
},
59151
{
60152
"cell_type": "code",
61153
"execution_count": null,
62-
"metadata": {
63-
"collapsed": true
64-
},
154+
"metadata": {},
65155
"outputs": [],
66156
"source": []
67157
}
68158
],
69159
"metadata": {
70160
"kernelspec": {
71-
"display_name": "Python [py27]",
161+
"display_name": "Python 3",
72162
"language": "python",
73-
"name": "Python [py27]"
163+
"name": "python3"
74164
},
75165
"language_info": {
76166
"codemirror_mode": {
77167
"name": "ipython",
78-
"version": 2
168+
"version": 3
79169
},
80170
"file_extension": ".py",
81171
"mimetype": "text/x-python",
82172
"name": "python",
83173
"nbconvert_exporter": "python",
84-
"pygments_lexer": "ipython2",
85-
"version": "2.7.12"
174+
"pygments_lexer": "ipython3",
175+
"version": "3.5.3"
86176
}
87177
},
88178
"nbformat": 4,
89-
"nbformat_minor": 0
179+
"nbformat_minor": 1
90180
}

0 commit comments

Comments
 (0)