forked from johannesgerer/jburkardt-m
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ball_and_stick_display.html
360 lines (321 loc) · 10.3 KB
/
ball_and_stick_display.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<html>
<head>
<title>
BALL_AND_STICK_DISPLAY - MATLAB 3D Plot Using Balls and Sticks
</title>
</head>
<body bgcolor="#eeeeee" link="#cc0000" alink="#ff3300" vlink="#000055">
<h1 align = "center">
BALL_AND_STICK_DISPLAY <br> MATLAB 3D Plot Using Balls and Sticks
</h1>
<hr>
<p>
<b>BALL_AND_STICK_DISPLAY</b>
is a MATLAB program which
illustrates the use of MATLAB's 3D plotting capability to make
a "ball and stick" plot.
</p>
<p>
MATLAB has many procedures for displaying numeric data in 3D using contours,
vector plots, surfaces and so on. However, sometimes an illustrator needs
to construct a simple 3D image of points and lines. Since the thing has
to show up as an illustration or a slide, the points are exaggerated to
balls, and the lines to sticks.
</p>
<p>
MATLAB's <b>plot3</b> command can create both kinds of objects, but
it helps to know how to specify the desired object properties for
color and size. The MATLAB help system is not very helpful when trying
to find out what properties you can specify and what values they can have.
</p>
<p>
So this program may be a helpful example of how a 3D object can be
created with knobby balls and colored sticks.
</p>
<p>
The particular object created here is intended to illustrate the
Lax-Wendroff scheme for approximating the solution of a hyperbolic
partial differential equation. The blue spheres represent points at
which data is known. The green spheres represent points at which
fluxes are estimated by computing differences between neighboring values.
The red sphere is the locationi of the updated solution value.
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files made available on this web page
are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>BALL_AND_STICK_DISPLAY</b> is available in
<a href = "../../m_src/ball_and_stick_display/ball_and_stick_display.html">a MATLAB version</a>.
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../m_src/bezier_surface_display/bezier_surface_display.html">
BEZIER_SURFACE_DISPLAY</a>,
a MATLAB program which
displays a Bezier surface;
</p>
<p>
<a href = "../../m_src/circle_grid_display/circle_grid_display.html">
CIRCLE_GRID_DISPLAY</a>,
a MATLAB program which reads a matrix of integers, and draws a corresponding
grid of circles filled with color.
</p>
<p>
<a href = "../../m_src/grid_display/grid_display.html">
GRID_DISPLAY</a>,
a MATLAB library which
can display a 2D or 3D grid or sparse grid.
</p>
<p>
<a href = "../../m_src/obj_display/obj_display.html">
OBJ_DISPLAY</a>,
a MATLAB program which
reads an OBJ 3D graphics file and displays it on the screen.
</p>
<p>
<a href = "../../m_src/ply_display/ply_display.html">
PLY_DISPLAY</a>,
a MATLAB program which
displays an image of a 3D graphics file in PLY format;
</p>
<p>
<a href = "../../m_src/polygonal_surface_display/polygonal_surface_display.html">
POLYGONAL_SURFACE_DISPLAY</a>,
a MATLAB program which
displays a surface in 3D described as a set of polygons;
</p>
<p>
<a href = "../../m_src/quad_surface_display/quad_surface_display.html">
QUAD_SURFACE_DISPLAY</a>,
a MATLAB program which
plots piecewise bilinear data associated with a QUAD_SURFACE, that is,
a 3D surface defined by a quadrilateral mesh;
</p>
<p>
<a href = "../../m_src/stla_display/stla_display.html">
STLA_DISPLAY</a>,
a MATLAB program which
reads an ASCII STL file and displays it on the screen.
</p>
<p>
<a href = "../../m_src/tet_mesh_display/tet_mesh_display.html">
TET_MESH_DISPLAY</a>,
a MATLAB program which
reads in the node and tetra files defining a tet mesh and displays a wireframe
image.
</p>
<p>
<a href = "../../m_src/tri_surface_display/tri_surface_display.html">
TRI_SURFACE_DISPLAY</a>,
a MATLAB program which
displays the 3D graphics information
in a TRI_SURFACE file;
</p>
<p>
<a href = "../../m_src/xyz_display/xyz_display.html">
XYZ_DISPLAY</a>,
a MATLAB program which
reads XYZ information defining points in 3D,
and displays an image in the MATLAB graphics window.
</p>
<p>
<a href = "../../m_src/xyzf_display/xyzf_display.html">
XYZF_DISPLAY</a>,
a MATLAB program which
reads XYZF information defining points and faces in 3D,
and displays an image using OpenGL.
</p>
<p>
<a href = "../../m_src/xyzl_display/xyzl_display.html">
XYZL_DISPLAY</a>,
a MATLAB program which
reads XYZL information defining points and lines in 3D,
and displays an image in a MATLAB graphics window.
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<b>BALL_AND_STICK_DISPLAY</b> displays a ball and stick plot.
<ul>
<li>
<a href = "ball_and_stick_display.m">ball_and_stick_display.m</a>,
the source code.
</li>
<li>
<a href = "ball_and_stick_display.png">ball_and_stick_display.png</a>,
a PNG snapshot of the 3D plot.
</li>
</ul>
</p>
<p>
<b>FIRST_ORDER_DISPLAY</b> displays a sequence of 8 images
illustrating a first order method for dealing with hyperbolic
equations. Hitting RETURN proceeds
to the next image.
<ul>
<li>
<a href = "first_order_display.m">first_order_display.m</a>,
the source code.
</li>
<li>
<a href = "first_order_0.png">first_order_0.png</a>,
a blank plotting field.
</li>
<li>
<a href = "first_order_1.png">first_order_1.png</a>,
a node where we have the solution.
</li>
<li>
<a href = "first_order_2.png">first_order_2.png</a>,
the region associated with the node.
</li>
<li>
<a href = "first_order_3.png">first_order_3.png</a>,
the neighboring nodes.
</li>
<li>
<a href = "first_order_4.png">first_order_4.png</a>,
fluxes are differences across the neighbors.
</li>
<li>
<a href = "first_order_5.png">first_order_5.png</a>,
a full time step is now taken.
</li>
<li>
<a href = "first_order_6.png">first_order_6.png</a>,
we have an estimate for the solution in this region.
</li>
<li>
<a href = "first_order_7.png">first_order_7.png</a>,
all the nodes can be advanced in this way.
</li>
</ul>
</p>
<p>
<b>LAX_WENDROFF_1D_DISPLAY</b> displays a sequence of images
illustrating the Lax-Wendroff method in 1D. Hitting RETURN proceeds
to the next image.
<ul>
<li>
<a href = "lax_wendroff_1d_display.m">lax_wendroff_1d_display.m</a>,
the source code.
</li>
<li>
<a href = "lw1d00.png">lw1d00.png</a>,
a blank plotting field.
</li>
<li>
<a href = "lw1d01.png">lw1d01.png</a>,
a node where we have the solution.
</li>
<li>
<a href = "lw1d02.png">lw1d02.png</a>,
the region associated with the node.
</li>
<li>
<a href = "lw1d03.png">lw1d03.png</a>,
the neighboring nodes.
</li>
<li>
<a href = "lw1d04.png">lw1d04.png</a>,
values at midsides by averaging.
</li>
<li>
<a href = "lw1d05.png">lw1d05.png</a>,
values at midside nodes, half time step.
</li>
<li>
<a href = "lw1d06.png">lw1d06.png</a>,
estimate fluxes.
</li>
<li>
<a href = "lw1d07.png">lw1d07.png</a>,
estimate derivative at node, half time step.
</li>
<li>
<a href = "lw1d08.png">lw1d08.png</a>,
take full step to new time.
</li>
<li>
<a href = "lw1d09.png">lw1d09.png</a>,
update all data.
</li>
<li>
<a href = "lw1d10.png">lw1d10.png</a>,
ready for next time step.
</li>
</ul>
</p>
<p>
<b>LAX_WENDROFF_2D_DISPLAY</b> displays a sequence of images
illustrating the Lax-Wendroff method in 2D. Hitting RETURN proceeds
to the next image.
<ul>
<li>
<a href = "lax_wendroff_2d_display.m">lax_wendroff_2d_display.m</a>,
the source code.
</li>
<li>
<a href = "lw2d0.png">lw2d0.png</a>,
a blank plotting field.
</li>
<li>
<a href = "lw2d1.png">lw2d1.png</a>,
a node where we have the solution.
</li>
<li>
<a href = "lw2d2.png">lw2d2.png</a>,
the region associated with the node.
</li>
<li>
<a href = "lw2d3.png">lw2d3.png</a>,
the neighboring nodes.
</li>
<li>
<a href = "lw2d4.png">lw2d4.png</a>,
values at midsides by averaging.
</li>
<li>
<a href = "lw2d5.png">lw2d5.png</a>,
values at midside nodes, half time step.
</li>
<li>
<a href = "lw2d6.png">lw2d6.png</a>,
estimate fluxes.
</li>
<li>
<a href = "lw2d7.png">lw2d7.png</a>,
estimate derivative at node, half time step.
</li>
<li>
<a href = "lw2d8.png">lw2d8.png</a>,
take full step to new time.
</li>
<li>
<a href = "lw2d9.png">lw2d9.png</a>,
update all data.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../m_src.html">
the MATLAB source codes</a>.
</p>
<hr>
<i>
Last modified on 01 July 2012.
</i>
<!-- John Burkardt -->
</body>
</html>