Table of Contents


snap3dv - create ascii file for 3D viewing from a snapshot


snap3dv in=snapshot_file out=ascii_file [parameters=values...]


snap3dv prepares an ascii file in some "3d" format (see MODE below) for viewing with some of the available interactive 3D display tools that are available under MSDOS, SunWindows and X-windows.

Three viewing coordinates must be selected, any general bodytrans(5NEMO) variable can be choosen, though generally x, y and z will suffice. A bounding box around the particles can be drawn, a different cube can be selected, but particles outside the cube are not visible. Each particle can be given its own color, based on an integer bodytrans function (the actual color on the screen wil depend on your device driver and hardware). Lastly, any subset of particles can be choosen for display using a visibility (0 or non-0) integer bodytrans function. For display tools that support the multiple layer concept, the non-zero value of the visibility is used to identify its layer. This often means that the form of the color and visib keywords are rather similar; for example,


The following parameters are recognized in any order if the keyword is also given:
Input data file, must be in standard snapshot(5NEMO) format [No default].
The value of x-expression is plotted along the X axis. x-expression is a real-valued C language expression over the real values x, y, z, vx, vy, vz, phi, t, and the integer value i. The default is x.
See above. The default is y.
See above. The default is z.
Range of values for the X axis, specified either as a single number (in which case the lower bound is zero) or a pair of numbers separated by a colon or none, if the program is to use autoscaling. The default range is autoscaling.
See above. The default is autoscaling.
See above. The default is autoscaling.
Only the first plot frame with the correct time value will be selected for output. The default is the first frame in a snapshot.
Determines the visibility of particles. expression is a integer expression in the above variables; only points with non-zero values are plotted. The default is 1.
Determines the point color. expression is an integer expression in the above variables; colors depend on your device driver/hardware. The default is 10.
Color of the border if to be plotted. set color to -1 if no border is requested.
Floating point format with which the X,Y,Z coordinates are plotted. Although the default format (%f) is general, one can generally find a format which produced a more compact file format. [Default: %f]
Output mode. Select any of the supported formats described in more detail below: 3dv, x3d, acd, wld or dcx. [Default: 3dv].

Mode: Wld

The ViewWld is a Suntools program, and accepts a list of vectors and/or points. The first 3 columns are the X,Y and Z positions. The 4th column is an integer denoting move(0), draw line(1) or draw point(2) .

Mode: 3dv

The 3DV format is a free format ascii listing consisting of two parts. For each part the first line consists of an integer denoting how many data lines this part consists of (excluding that header line). This first part defines the X,Y,Z positions of N points in 3D space:
         X1 Y1 Z2
         X2 Y2 Z2
         XN YN ZN
The second part consists of the drawing operations, now referring to the points by their index number (1 being the first one). The point index number is in the first column; if the second column is 0, it means a move (with no color), for a non-zero number it is a draw to that next point with a color as specified by by that integer. It will depend on your hardware what the color is. Again, the first line in this part consists of an integer how many "line-segments" will follow.

For example, to draw N points withouth connecting lines, each point needs 2 segments:

         i 0
         i color

NOTE: the 3dv program can only handle 1500 or so stars. It then quickly runs out of memory. (an old 1988 version of the program was tested for this)

Mode: X3d

The X3D format is used by a public domain program x3d. It is a simple ascii file, with 3 sections. The first section is one line, containing 2 integers: number of points, and number of segments. The next two sections are the points and the segments. Points have 3 real coordinates, segments two integers, describing which two points are to be connected.
X1 Y1 Z1
F1 T1

Mode: Acd

AcroSpin(tm) format can be written in a very compact way: 5 columns with resp. X, Y, Z, Color and Layer, with a one line header describing its format:
    Pointlist X Y Z Color Layer
    X1 Y1 Z1 C1 L1
    X2 Y2 Z2 C2 L2
Note that the total number of particles is not needed in this format.

Mode: Dcx

This (binary) format is used by programs such as AutoCAD(tm). We do not support it, but the MSDOS program ACROTRAN can translate such files into acd format.

Mode: 3ds

A new popular 3D Studio dataformat (not implemented in NEMO).

See Also

bodytyrans(1NEMO) , snapshot(5NEMO) , snapxyz(1NEMO)        x3d.2.2.tar.Z (28-jun-94)    newer (tested 2003)                            3D Studio File Format
Library Homepage


Peter Teuben


~/src/nbody/io/     snap3dv.c 

Update History

26-sep-91    V0.0: created for MSDOS     PJT
9-oct-91    V1.0: adapted for NEMO to read snapshots instead    PJT
10-oct-91    V1.0a: added the ACD format    PJT
11-oct-91    V1.0b: added WLD format     PJT
8-sep-95    V1.0c: added X3D format      PJT
10-jan-96    V1.0d: upgraded for new X3D (V2.2) format    PJT

Table of Contents