xyz_io


xyz_io, a C++ code which reads and writes simple graphics 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 listed in a record. Thus, an XYZL file associated with the above XYZ file might be:

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

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
#
  0 3 2 1
  1 2 6 5
  4 5 6 7
  4 7 3 0
  0 1 5 4
  2 3 7 6
      

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

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

Related Data and codes:

xyz_io_test

ivread, a FORTRAN90 code which converts graphics information between various 3D formats, including the XYZ format.

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

stripack_interactive, a FORTRAN90 code which reads an XYZ file of 3D points on the unit sphere, computes the Delaunay triangulation, and writes it to a file.

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 code which reads XYZ information defining points in 3D, and displays an image in the MATLAB graphics window.

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

xyz_to_pdb, a FORTRAN90 code 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 code which reads XYZF information defining points and faces in 3D, and displays an image.

xyzf_display_opengl, a C++ code which reads XYZF information defining 3D points and faces 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 code which reads XYZL information defining points and lines in 3D, and displays an image.

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

Source Code:


Last revised on 29 October 2024.