forked from johannesgerer/jburkardt-m
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xyz_io.html
464 lines (422 loc) · 12.9 KB
/
xyz_io.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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
<html>
<head>
<title>
XYZ_IO - XYZ File Input/Output routines.
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
XYZ_IO <br> XYZ File Input/Output routines.
</h1>
<hr>
<p>
<b>XYZ_IO</b>
is a MATLAB library which
reads and writes files in the XYZ, XYZL and XYZF formats.
</p>
<p>
XYZ files are a simple way of storing information about sets of points in 3D.
</p>
<p>
An XYZ file has a simple structure. There are three kinds of records:
<ul>
<li>
COMMENT LINES begin with the character '#' and are ignored;
</li>
<li>
BLANK LINES are ignored;
</li>
<li>
COORDINATE LINES each contain one triple of XYZ coordinates;
</li>
</ul>
</p>
<p>
Here is an example of an XYZ file containing 13 points:
<pre>
# cube.xyz
#
0.000000 0.000000 0.000000
1.000000 0.000000 0.000000
1.000000 1.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
1.000000 0.000000 1.000000
1.000000 1.000000 1.000000
0.000000 1.000000 1.000000
</pre>
</p>
<p>
Of course, in many cases, we would like to describe LINES between the points.
We can add this information by including a second file, called an XYZL file,
which consists of a string of point indices. A line is drawn from one point
to the next, and so on for each point index on a record. Thus, an XYZL file
associated with the above XYZ file might be:
<pre>
# cube.xyzl
#
1 2 3 4 1
5 6 7 8 5
1 5
2 6
3 7
4 8
</pre>
</p>
<p>
We might also like to describe FACES defined by the points.
We can add this information by including a file, called an XYZF file,
which consists of a string of point indices. A face is defined by
listing in counterclockwise order the vertices that lie on it.
The first vertex is not repeated
as the final vertex. Thus, an XYZF file
associated with the above XYZ file might be:
<pre>
# cube.xyzf
#
1 4 3 2
2 3 7 6
5 6 7 8
5 8 4 1
1 2 6 5
3 4 8 7
</pre>
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files described and 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>XYZ_IO</b> is available in
<a href = "../../cpp_src/xyz_io/xyz_io.html">a C++ version</a> and
<a href = "../../f_src/xyz_io/xyz_io.html">a FORTRAN90 version</a> and
<a href = "../../m_src/xyz_io/xyz_io.html">a MATLAB version</a>.
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../f_src/ivread/ivread.html">
IVREAD</a>,
a FORTRAN90 program which
can convert graphics information between various 3D formats,
including the XYZ format.
</p>
<p>
<a href = "../../f_src/pdb_to_xyz/pdb_to_xyz.html">
PDB_TO_XYZ</a>,
a FORTRAN90 program which
reads the ATOM records
from a PDB file, and writes the atomic coordinates to an XYZ file.
</p>
<p>
<a href = "../../f_src/stripack_interactive/stripack_interactive.html">
STRIPACK_INTERACTIVE</a>,
a FORTRAN90 program which
reads an XYZ file of 3D points on
the unit sphere, computes the Delaunay triangulation, and writes it
to a file.
</p>
<p>
<a href = "../../f_src/sxyz_voronoi/sxyz_voronoi.html">
SXYZ_VORONOI</a>,
a FORTRAN90 library which
reads an XYZ file of 3D points on the unit sphere, and
computes and plots Delaunay triangulations and Voronoi diagrams.
</p>
<p>
<a href = "../../data/table/table.html">
TABLE</a>,
a data directory which
contains examples of TABLE files,
a simple format for N points in M dimensions;
</p>
<p>
<a href = "../../data/xy/xy.html">
XY</a>,
a data directory which
contains examples of XY files,
a simple 2D graphics point and line format;
</p>
<p>
<a href = "../../data/xyz/xyz.html">
XYZ</a>,
a data directory which
contains examples of XYZ files,
a simple 3D graphics point and line format;
</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 = "../../cpp_src/xyz_display_opengl/xyz_display_opengl.html">
XYZ_DISPLAY_OPENGL</a>
a C++ program which
reads an XYZ file of 3D point coordinates, and displays
an image of those points using OpenGL.
</p>
<p>
<a href = "../../f_src/xyz_to_pdb/xyz_to_pdb.html">
XYZ_TO_PDB</a>,
a FORTRAN90 program which
reads a set of XYZ spatial coordinates, and
rewrites them as ATOM records in a PDB file.
</p>
<p>
<a href = "../../data/xyzf/xyzf.html">
XYZF</a>,
a data directory which
contains examples of XYZF files,
a simple 3D graphics point and face format;
</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 in a MATLAB graphics window.
</p>
<p>
<a href = "../../cpp_src/xyzf_display_opengl/xyzf_display_opengl.html">
XYZF_DISPLAY_OPENGL</a>
a C++ program which
reads XYZF information defining points and faces in 3D, and displays
an image using OpenGL.
</p>
<p>
<a href = "../../data/xyzl/xyzl.html">
XYZL</a>,
a data directory which
contains examples of XYZL files,
a simple 3D graphics point and line format;
</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>
<p>
<a href = "../../cpp_src/xyzl_display_opengl/xyzl_display_opengl.html">
XYZL_DISPLAY_OPENGL</a>,
a C++ program which
reads XYZL information defining points and lines in 3D, and displays
an image using OpenGL.
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "s_len_trim.m">s_len_trim.m</a>,
returns the length of a string to the last nonblank.
</li>
<li>
<a href = "s_word_count.m">s_word_count.m</a>,
returns the number of "words" in a string.
</li>
<li>
<a href = "timestamp.m">timestamp.m</a>,
prints the current YMDHMS date as a timestamp.
</li>
<li>
<a href = "xyz_data_print.m">xyz_data_print.m</a>,
prints the data of an XYZ file.
</li>
<li>
<a href = "xyz_data_read.m">xyz_data_read.m</a>,
reads the data of an XYZ file.
</li>
<li>
<a href = "xyz_data_write.m">xyz_data_write.m</a>,
writes the data of an XYZ file.
</li>
<li>
<a href = "xyz_example.m">xyz_example.m</a>,
sets up sample XYZ data.
</li>
<li>
<a href = "xyz_example_size.m">xyz_example_size.m</a>,
sizes the sample XYZ data.
</li>
<li>
<a href = "xyz_header_print.m">xyz_header_print.m</a>,
prints the header of an XYZ file.
</li>
<li>
<a href = "xyz_header_read.m">xyz_header_read.m</a>,
reads the header of an XYZ file.
</li>
<li>
<a href = "xyz_header_write.m">xyz_header_write.m</a>,
writes the header of an XYZ file.
</li>
<li>
<a href = "xyz_read.m">xyz_read.m</a>,
reads an XYZ file.
</li>
<li>
<a href = "xyz_write.m">xyz_write.m</a>,
writes an XYZ file.
</li>
<li>
<a href = "xyz_write_test.m">xyz_write_test.m</a>,
tests the XYZ write routines.
</li>
<li>
<a href = "xyzf_data_print.m">xyzf_data_print.m</a>,
prints the data of an XYZF file.
</li>
<li>
<a href = "xyzf_data_read.m">xyzf_data_read.m</a>,
reads the data of an XYZF file.
</li>
<li>
<a href = "xyzf_data_write.m">xyzf_data_write.m</a>,
writes the data of an XYZF file.
</li>
<li>
<a href = "xyzf_example.m">xyzf_example.m</a>,
sets up sample XYZF data.
</li>
<li>
<a href = "xyzf_example_size.m">xyzf_example_size.m</a>,
sizes the sample XYZF data.
</li>
<li>
<a href = "xyzf_header_print.m">xyzf_header_print.m</a>,
prints the header of an XYZF file.
</li>
<li>
<a href = "xyzf_header_read.m">xyzf_header_read.m</a>,
reads the header of an XYZF file.
</li>
<li>
<a href = "xyzf_header_write.m">xyzf_header_write.m</a>,
writes the header of an XYZF file.
</li>
<li>
<a href = "xyzf_write.m">xyzf_write.m</a>,
writes an XYZF file.
</li>
<li>
<a href = "xyzl_data_print.m">xyzl_data_print.m</a>,
prints the data of an XYZL file.
</li>
<li>
<a href = "xyzl_data_read.m">xyzl_data_read.m</a>,
reads the data of an XYZL file.
</li>
<li>
<a href = "xyzl_data_write.m">xyzl_data_write.m</a>,
writes the data of an XYZL file.
</li>
<li>
<a href = "xyzl_example.m">xyzl_example.m</a>,
sets up sample XYZL data.
</li>
<li>
<a href = "xyzl_example_size.m">xyzl_example_size.m</a>,
sizes the sample XYZL data.
</li>
<li>
<a href = "xyzl_header_print.m">xyzl_header_print.m</a>,
prints the header of an XYZL file.
</li>
<li>
<a href = "xyzl_header_read.m">xyzl_header_read.m</a>,
reads the header of an XYZL file.
</li>
<li>
<a href = "xyzl_header_write.m">xyzl_header_write.m</a>,
writes the header of an XYZL file.
</li>
<li>
<a href = "xyzl_write.m">xyzl_write.m</a>,
writes an XYZL file.
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "xyz_io_test.m">xyz_io_test.m</a>,
a sample calling program.
</li>
<li>
<a href = "xyz_io_test_output.txt">xyz_io_test_output.txt</a>,
the output from a run of the sample program.
</li>
<li>
<a href = "xyz_io_test01.m">xyz_io_test01.m</a>,
demonstrates the use of XYZ_WRITE routines.
</li>
<li>
<a href = "xyz_io_test02.m">xyz_io_test02.m</a>,
demonstrates the use of XYZ_READ routines.
</li>
<li>
<a href = "xyz_io_test03.m">xyz_io_test03.m</a>,
demonstrates the use of XYZL_WRITE routines.
</li>
<li>
<a href = "xyz_io_test04.m">xyz_io_test04.m</a>,
demonstrates the use of XYZL_READ routines.
</li>
<li>
<a href = "xyz_io_test05.m">xyz_io_test05.m</a>,
demonstrates the use of XYZF_WRITE routines.
</li>
<li>
<a href = "xyz_io_test06.m">xyz_io_test06.m</a>,
demonstrates the use of XYZF_READ routines.
</li>
<li>
<a href = "helix.xyz">helix.xyz</a>,
an XYZ file created by the example program.
</li>
<li>
<a href = "xy_io_prb_02.xyz">xy_io_prb_02.xyz</a>,
an XYZ file created by the example program.
</li>
<li>
<a href = "cube.xyz">cube.xyz</a>,
an XYZ file of points created by the example program.
</li>
<li>
<a href = "cube.xyzl">cube.xyzl</a>,
an XYZL file of lines created by the example program.
</li>
<li>
<a href = "cube.xyzf">cube.xyzf</a>,
an XYZF file of lines created by the example program.
</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 revised on 08 January 2009.
</i>
<!-- John Burkardt -->
</body>
</html>