This applet demonstrates how to parse a geometry file in a user
defined file format. As an example, this tutorial uses a very simple
file format called abc which is
defined solely for this tutorial. Note, JavaView does not support this file format except in this tutorial.
The abc format has a comment header, followed by a list of
vertices in R3 and an optional list of faces. The loader generates
a point set or an element set depending on whether faces are supplied.
A sample geometry file is cube.abc. To write
an own parser simply modify this loader. It is a good idea to name
the loader by the extension of your file format.
The applet parameter filename may be a relative name or
the URL of an abc geometry file.
View source code:
PaLoader.java of applet,
PgAbcLoader.java of loader,
cube.abc,
cubePoints.abc
Here is an example of a cube in the sample file
format abc. Note the faces are optional in
this dataset.
8
0.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
0.0 1.0 1.0
1.0 1.0 1.0
1.0 0.0 1.0
6
0 1 2 3
4 7 6 5
0 4 5 1
1 5 6 2
2 6 7 3
3 7 4 0