XYZ_IO
XYZ File Input/Output routines.


XYZ_IO is a MATLAB library which reads and writes files in the XYZ, XYZL and XYZF formats.

XYZ files are a simple way of storing information about sets of points in 3D.

An XYZ file has a simple structure. There are three kinds of records:

Here is an example of an XYZ file containing 13 points:

#  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
      

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:

#  cube.xyzl
#
  1 2 3 4 1
  5 6 7 8 5
  1 5
  2 6
  3 7
  4 8
      

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:

#  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
      

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

XYZ_IO is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

IVREAD, a FORTRAN90 program which can convert graphics information between various 3D formats, including the XYZ format.

PDB_TO_XYZ, a FORTRAN90 program which reads the ATOM records from a PDB file, and writes the atomic coordinates to an XYZ file.

STRIPACK_INTERACTIVE, 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.

SXYZ_VORONOI, a FORTRAN90 library which reads an XYZ file of 3D points on the unit sphere, and computes and plots Delaunay triangulations and Voronoi diagrams.

TABLE, a data directory which contains examples of TABLE files, a simple format for N points in M dimensions;

XY, a data directory which contains examples of XY files, a simple 2D graphics point and line format;

XYZ, a data directory which contains examples of XYZ files, a simple 3D graphics point and line format;

XYZ_DISPLAY a MATLAB program which reads XYZ information defining points in 3D, and displays an image in the MATLAB graphics window.

XYZ_DISPLAY_OPENGL a C++ program which reads an XYZ file of 3D point coordinates, and displays an image of those points using OpenGL.

XYZ_TO_PDB, a FORTRAN90 program which reads a set of XYZ spatial coordinates, and rewrites them as ATOM records in a PDB file.

XYZF, a data directory which contains examples of XYZF files, a simple 3D graphics point and face format;

XYZF_DISPLAY a MATLAB program which reads XYZF information defining points and faces in 3D, and displays an image in a MATLAB graphics window.

XYZF_DISPLAY_OPENGL a C++ program which reads XYZF information defining points and faces in 3D, and displays an image using OpenGL.

XYZL, a data directory which contains examples of XYZL files, a simple 3D graphics point and line format;

XYZL_DISPLAY, a MATLAB program which reads XYZL information defining points and lines in 3D, and displays an image in a MATLAB graphics window.

XYZL_DISPLAY_OPENGL, a C++ program which reads XYZL information defining points and lines in 3D, and displays an image using OpenGL.

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.


Last revised on 08 January 2009.