forked from johannesgerer/jburkardt-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xy_io.html
433 lines (392 loc) · 11.6 KB
/
xy_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
<html>
<head>
<title>
XY_IO - XY File Input/Output routines.
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
XY_IO <br> XY File Input/Output routines.
</h1>
<hr>
<p>
<b>XY_IO</b>
is a C++ library which
reads and writes files in the XY, XYL and XYF formats.
</p>
<p>
XY files are a simple way of storing information about sets of points in 2D.
</p>
<p>
An XY 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 pair of X, Y coordinates;
</li>
</ul>
</p>
<p>
Here is an example of an XY file containing 13 points:
<pre>
# house.xy
#
0.000000 0.000000
6.000000 0.000000
6.000000 7.000000
3.000000 10.000000
0.000000 7.000000
4.000000 1.000000
5.000000 1.000000
5.000000 4.000000
4.000000 4.000000
5.000000 8.000000
5.000000 11.000000
4.000000 11.000000
4.000000 9.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 XYL file,
which consists of a string of point indices. A line is drawn from one point
to the next and so on through each point listed on a record. Thus, an XYL file
associated with the above XY file might be:
<pre>
# house.xyl
#
0 1 2 3 4 0
5 6 7 8 5
9 10 11 12
</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 XYF 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 XYF file
associated with the above XY file might be:
<pre>
# house.xyf
#
0 1 2 3 4
5 6 7 8
9 10 11 12
</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>XY_IO</b> is available in
<a href = "../../cpp_src/xy_io/xy_io.html">a C++ version</a> and
<a href = "../../f_src/xy_io/xy_io.html">a FORTRAN90 version</a> and
<a href = "../../m_src/xy_io/xy_io.html">a MATLAB version</a>.
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../f_src/circle_points/circle_points.html">
CIRCLE_POINTS</a>,
a FORTRAN90 program which
computes points equally spaced on a circular arc, and writes them to an XY file;
</p>
<p>
<a href = "../../f_src/grf_to_xyl/grf_to_xyl.html">
GRF_TO_XYL</a>,
a FORTRAN90 program which
converts information describing the adjacency and embedding of an
abstract graph from GRF to XYL format.
</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 format;
</p>
<p>
<a href = "../../m_src/xy_display/xy_display.html">
XY_DISPLAY</a>,
a MATLAB program which
reads an XY file containing
the coordinates of points in 2D, and displays a plot of the
points in a MATLAB graphics window;
</p>
<p>
<a href = "../../cpp_src/xy_display_opengl/xy_display_opengl.html">
XY_DISPLAY_OPENGL</a>,
a C++ program which
reads an XY file of 2D point coordinates, and displays
an image of those points using OpenGL.
</p>
<p>
<a href = "../../data/xyf/xyf.html">
XYF</a>,
a data directory which
contains examples of XYF files,
a simple 2D graphics point and face format;
</p>
<p>
<a href = "../../m_src/xyf_display/xyf_display.html">
XYF_DISPLAY</a>,
a MATLAB program which
reads XYF information defining points and faces in 2D, and displays
an image using MATLAB.
</p>
<p>
<a href = "../../cpp_src/xyf_display_opengl/xyf_display_opengl.html">
XYF_DISPLAY_OPENGL</a>,
a C++ program which
reads XYF information defining points and faces in 2D, and displays
an image using OpenGL.
</p>
<p>
<a href = "../../data/xyl/xyl.html">
XYL</a>,
a data directory which
contains examples of XYL files,
a simple 2D graphics point and line format;
</p>
<p>
<a href = "../../m_src/xyl_display/xyl_display.html">
XYL_DISPLAY</a>,
a MATLAB program which
reads XYL information defining points and lines in 2D, and displays
an image using MATLAB.
</p>
<p>
<a href = "../../cpp_src/xyl_display_opengl/xyl_display_opengl.html">
XYL_DISPLAY_OPENGL</a>,
a C++ program which
reads XYL information defining points and lines in 2D, and displays
an image using OpenGL.
</p>
<p>
<a href = "../../cpp_src/xyz_io/xyz_io.html">
XYZ_IO</a>,
a C++ library which
reads and writes XYZ files, a simple 3D graphics point format.
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "xy_io.cpp">xy_io.cpp</a>, the source code.
</li>
<li>
<a href = "xy_io.hpp">xy_io.hpp</a>, the include file.
</li>
<li>
<a href = "xy_io.sh">xy_io.sh</a>,
commands to compile the source code.
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "xy_io_prb.cpp">xy_io_prb.cpp</a>,
a sample calling program.
</li>
<li>
<a href = "xy_io_prb.sh">xy_io_prb.sh</a>,
commands to compile and run the sample program.
</li>
<li>
<a href = "xy_io_prb_output.txt">xy_io_prb_output.txt</a>,
the output file.
</li>
<li>
<a href = "xy_io_prb_01.xy">xy_io_prb_01.xy</a>,
an XY file created by the example program.
</li>
<li>
<a href = "xy_io_prb_02.xy">xy_io_prb_02.xy</a>,
an XY file created by the example program.
</li>
<li>
<a href = "house.xy">house.xy</a>,
an XY file of points created by the example program.
</li>
<li>
<a href = "house.xyl">house.xyl</a>,
an XYL file of lines created by the example program.
</li>
<li>
<a href = "annulus.xy">annulus.xy</a>,
an XY file of points created by the example program.
</li>
<li>
<a href = "annulus.xyf">annulus.xyf</a>,
an XYF file of lines created by the example program.
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>CH_EQI</b> is true if two characters are equal, disregarding case.
</li>
<li>
<b>CH_TO_DIGIT</b> returns the integer value of a base 10 digit.
</li>
<li>
<b>I4VEC_COPY</b> copies an I4VEC.
</li>
<li>
<b>R8VEC_COPY</b> copies an R8VEC.
</li>
<li>
<b>S_LEN_TRIM</b> returns the length of a string to the last nonblank.
</li>
<li>
<b>S_TO_I4</b> reads an I4 from a string.
</li>
<li>
<b>S_TO_I4VEC</b> reads an I4VEC from a string.
</li>
<li>
<b>S_TO_R8</b> reads an R8 value from a string.
</li>
<li>
<b>S_TO_R8VEC</b> reads an R8VEC from a string.
</li>
<li>
<b>S_WORD_COUNT</b> counts the number of "words" in a string.
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</li>
<li>
<b>XY_DATA_PRINT</b> prints the data for an XY file.
</li>
<li>
<b>XY_DATA_READ</b> reads the data in an XY file.
</li>
<li>
<b>XY_DATA_WRITE</b> writes the data for an XY file.
</li>
<li>
<b>XY_EXAMPLE</b> sets up sample XY data suitable for an XY file.
</li>
<li>
<b>XY_HEADER_PRINT</b> prints the header of an XY file.
</li>
<li>
<b>XY_HEADER_READ</b> reads the header of an XY file.
</li>
<li>
<b>XY_HEADER_WRITE</b> writes the header of an XY file.
</li>
<li>
<b>XY_READ</b> reads the header and data from an XY file.
</li>
<li>
<b>XY_READ_TEST</b> tests the XY file read routines.
</li>
<li>
<b>XY_WRITE</b> writes the header and data for an XY file.
</li>
<li>
<b>XY_WRITE_TEST</b> tests the XY write routines.
</li>
<li>
<b>XYF_DATA_PRINT</b> prints the data of an XYF file.
</li>
<li>
<b>XYF_DATA_READ</b> reads the data in an XYF file.
</li>
<li>
<b>XYF_DATA_WRITE</b> writes the data of an XYF file.
</li>
<li>
<b>XYF_EXAMPLE</b> sets data suitable for a pair of XY and XYF files.
</li>
<li>
<b>XYF_EXAMPLE_SIZE</b> sizes the data to be created by XYF_EXAMPLE.
</li>
<li>
<b>XYF_HEADER_PRINT</b> prints the header of an XYF file.
</li>
<li>
<b>XYF_HEADER_READ</b> determines the number of face items in an XYF file.
</li>
<li>
<b>XYF_HEADER_WRITE</b> writes the header of an XYF file.
</li>
<li>
<b>XYF_WRITE</b> writes the header and data for an XYF file.
</li>
<li>
<b>XYL_DATA_PRINT</b> prints the data of an XYL file.
</li>
<li>
<b>XYL_DATA_READ</b> reads the data in an XYL file.
</li>
<li>
<b>XYL_DATA_WRITE</b> writes the data of an XYL file.
</li>
<li>
<b>XYL_EXAMPLE</b> sets data suitable for a pair of XY and XYL files.
</li>
<li>
<b>XYL_EXAMPLE_SIZE</b> sizes the data to be created by XYL_EXAMPLE.
</li>
<li>
<b>XYL_HEADER_PRINT</b> prints the header of an XYL file.
</li>
<li>
<b>XYL_HEADER_READ</b> determines the number of line items in an XYL file.
</li>
<li>
<b>XYL_HEADER_WRITE</b> writes the header of an XYL file.
</li>
<li>
<b>XYL_WRITE</b> writes the header and data for an XYL file.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../cpp_src.html">
the C++ source codes</a>.
</p>
<hr>
<i>
Last revised on 08 January 2009.
</i>
<!-- John Burkardt -->
</body>
<!-- Initial HTML skeleton created by HTMLINDEX. -->
</html>