xyz_io


xyz_io, a MATLAB 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 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 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 can convert 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.

sxyz_voronoi, a Fortran90 code 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 code which reads XYZ information defining points in 3D, and displays an image.

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 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 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 points and lines in 3D, and displays an image using OpenGL.

Source Code:


Last revised on 30 October 2024.