logo
Overview  First Applet  First Application   First Graph  First Project  Models  Loader  Keyframe  Linear Alg  Torus Knot  Picking  Camera Events  Color Selector  Slider  Ruler  Vector Field  Polygon Sets  Scalar Field   ODE  Root Finder  Parm Curve  Parm Surface  L-System  Texture  Refinement  4D Transform  Size Vertex  Size Polygon  Size Edge 

Tutorial on Using and Writing a Loader for Own Geometry File Formats

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
        
© 1997-2017 Last modified: 22.06.2017 --- www.javaview.de --- The JavaView Project