Pixmax commands

Content


Overview

3dtext
background
draw box
draw color
draw face
draw mesh
draw obj
draw xy_grid
draw xz_grid
draw yz_grid
set app
set auto_r
set axis_ti
set border_c
set border_w
set box
set cb_pos
set cb_size
set cb_skip
set cb_ticks
set center
set cont
set coord
set dist
set edge_c
set edge_sh
set edge_w
set face_c
set face_sh
set font
set format
set grid_b
set grid_f
set hidden_c
set light
set line_c
set line_dz
set line_sh
set line_w
set lut
set null
set obj_cont
set obj_edge
set obj_face
set out_tol
set periodic_lut
set render_am
set shift
set text_bg
set text_fg
set using
set view
set xrange
set xticks
set yrange
set yticks
set zoom
set zrange
set zticks
text
xaxis
yaxis
zaxis

Details

In this section the syntax of all commands is described. The syntax is indicated in the first line using a C-style notation. This is followed by one ore more example lines. Note, that the commas between the parameters are important. They should be used as indicated here. Additional or missing commas lead to syntax errors.
3dtext
3dtext (double) x, (double) y, (double) z (string) text
3dtext 0.1,-0.2,0.3 Hello
3dtext 0.1,-0.2,0.3 "Hello world!"
Write text at a given 3d-position. (x,y,z) are relative box-coordinates. These coordinates run from -1 to 1 along each side of the virtual box. Strings which contain blanks must be enclosed in quotation marks. The justification of the text is controlled by the set center command.

background
background (int) red, (int) green, (int) blue
background 255,255,255
Set background color. 0,0,0 is black and 255,255,255 is bright white.

draw_box
draw box
Draw edges of virtual box.

draw color
draw color (double) from, (double) to
draw color -2.0,1.5
Draw colorbar for given value-range. The appearance of the colorbar is controlled by the set cb_pos, set cb_size, set cb_skip and set cb_ticks commands. The current line width and line color are used to draw a frame around the colorbar and tick-marks. The current font and text colors are used to draw the tick labels.

draw face
draw face (string) file-name
draw face example.dat
Draw object with irregular data structure. The parameter file-name is the name of the data file in 'face'-format. See also the face-format section.

draw mesh
draw mesh (string) file-name
draw mesh example.dat
Draw object with regular data structure. The parameter file-name is the name of the data file in 'mesh'-format. See also the mesh-format section.

draw obj
draw obj (string) file-name
draw obj example.dat
Draw object with irregular data structure. The parameter file-name is the name of the data file in 'obj'-format. See also the obj-format section.

draw xy_grid
draw xz_grid
draw yz_grid
draw xy_grid (double) pos (int) nx, (int) ny
draw xy_grid -1 3,3
Draw grid in 'xy'-plane (or 'xz'-, 'yz'-plane). The parameter pos gives the 'z'-position of the grid in relative box-coordinates. These coordinates run from -1 to 1 along each side of the virtual box. The integers nx and ny give the number of grid lines for the respective direction. The appearance of the grid is controlled by the commands set grid_b and set grid_f. See also the example section.

set app
set app (string) key
set app fes
Set many parameters in one command. key is a string with the key letters 'FfEeCcSsRr'. The order of the letters is important. The letters 's' and 'r' work only directly behind an 'f', 'e' or 'c'.
Single                          Combinations

f:    draw faces                fr:         draw faces using light effect
e:    draw edges                            
c:    draw contour lines        fs,es,cs:   draw faces,edges or contour lines
                                            and take color from look-up-table
The set app, command replaces the deprecated commands set face_sh, set edge_sh, set obj_cont, set obj_face and set obj_edge. See also the light effect section below and the example section.

set auto_r
set auto_r (char) key
set auto_r x
The parameter key is either 'x', 'y' or 'z'. The command switches off the fix coordinate range set by a preceding set xrange, set yrange or set zrange command. The range is computed from the minimum and maximum value in the data set.

set axis_ti
set axis_ti (double) rtic, (double) rlab
set axis_ti 1.15,1.2
Set the form of the axis tick-marks and the position of the tick labels. The parameter rtic determines the end point of the tick label. It is given as relative distance from from the middle of the virtual box. rtic=1.0 gives no tick labels (zero length). rtic > 1.0 leads to outwards pointing tick marks. tic < 1.0 gives inwards pointing tick marks. The default value is rtic=1.05.
The parameter rlab gives the position of the tick labels. The same scaling as for rtic is used. The default value is rlab=1.1.

set border_c
set border_c (int) r, (int) g, (int) b
set border_c 0,255,255
Set the color used to draw the grid borders. r, g and b are integers between 0 and 255. See draw xy_grid for more.

set border_w
set border_w (int) w
set border_w 2
Set the width of border-lines. The parameter w gives the value in pixels. This width is used to draw the border of the grids. See draw xy_grid for more.

set box
set box (double) x, (double) y, (double) z
set box 2,2,1
Set the extension of the virtual box in 'x', 'y' and 'z'-direction. Only the ratio between the given values is used. A tiny 'z'-value can be used for 2d-plots.

set cb_pos
set cb_pos (int) x, (int) y
set cb_pos 400,20
Set the position of the colorbar. The 2d-coordinates are given in pixels. Reference point is the upper left corner of the colorbar. This setting is used when the draw color command is performed.

set cb_size
set cb_size (int) dx, (int) dy
set cb_size 100,10
Set the size of the colorbar. The size is given in pixels. This setting is used when the draw color command is performed. The ration of dx and dy determines the orientation of the colorbar. If dx > dy, then a horizontal colorbar is generated and the labels are below the bar. Otherwise the colorbar is vertical and the labels are on it's left side.

set cb_skip
set cb_skip (int) len, (int) dist
set cb_skip 5,10
Set the length of the tick-marks on the colorbar and the position of the tick-labels. The parameters len and dist are given in pixels. dist is the distance of the label from the colorbar. This setting is used when the draw color command is performed.

set cb_ticks
set cb_ticks (int) n
set cb_ticks 3
Set the number of tick marks with labels along the colorbar. This setting is used when the draw color command is performed.

set center
set center (string) key
set center rc
Set the text-justification. key is a string which should consist of two letters. The first means 'l'=left, 'c'=center or 'r'=right. The second means 'b'=bottom, 'c'=center or 't'=top. This setting effects text-drawing with the text and the 3dtext command.

set cont
set cont (double) start, (double) step, (double) end
set cont 0.0,0.1,1.0
Set the levels for the contour lines. A series of contour-levels is defined. The values are:
level(n) = start ± n × step
All levels are between start and end.    

set coord
set coord (int) nx, (int) ny, (int) ny
set coord 1,2,4
Set the data column which is taken as coordinate values. By default the columns (1,2,3) are taken as coordinates (x,y,z). All data lines in the file have to contain the requested columns. The programs aborts, if data is missing. The first column has the index '1'. The index '0' has a special meaning. In this case the respective coordinate is set to zero for all data points. This can be used to project all points on a plane. The example shows how this works.

set dist
set dist (double) r
set dist 10.0
Set the distance between the virtual observer and the middle of the virtual box. The value r is relative to the maximum extension of the virtual box. Default is a value of r=10.0. A very large value leads to parallel projection.

set edge_c
set edge_c (int) r, (int) g, (int) b
set edge_c 64,63,127
Set the color used for edge-line drawings. r, g and b are integers between 0 and 255.

set edge_sh
set edge_sh (char) key
set edge_sh r
Enables (key=y/yes) or disables (key=n/no) the lut-shading of edge lines. If disabled, the edges are plotted using a fix color. If enabled, the color is computed using a look-up-table.
This command is deprecated. The command set appear should be used.

set edge_w
set edge_w (int) w
set edge_w 2
Set the width of edge-lines. The parameter w gives the value in pixels. This width is used for drawing the mesh lines and the edges of the faces.

set face_c
set face_c (int) r, (int) g, (int) b
set face_c 255,63,127
Set the color used for face drawings. r, g and b are integers between 0 and 255. See also the set hidden_c command.

set face_sh
set face_sh (char) key
set face_sh r
Set the way in which the faces are drawn. key is 'y', 'n' or 'r'. In the case of 'n' the faces are drawn using a fix color. When key is 'y' the color is computed using the look-up-table. In the case of key='r' the faces are drawn using the light-effect mode.
This command is deprecated. The command set appear should be used.

set font
set font (string) font-file
set font 9x15bold
Loads a font from a the given font file. The font-file is searched in the directory given by the font-path. See also the fonts section.

set format
set format (string) key
set format .2E
Set number format of tick labels. The parameter key gives the format in a c-style standard. Default is '.1f' (=one digit after point). To get an integer format '.0' should be set.

set grid_b
set grid_b (char) key
set grid_b y
Enables (key=y/yes) or disables (key=n/no) the plotting of grid borders. See also the draw xy_grid command.

set grid_f
set grid_f (char) key
set grid_f y
Enables (key=y/yes) or disables (key=n/no) the plotting of grid faces. See also the draw xy_grid command.

set hidden_c
set hidden_c (int) r, (int) g, (int) b
set hidden_c 255,63,127
Set the color which is used to draw the back-side of faces. The command is used to get different colors for front and back of the faces. The set face_c command sets the color of both - front and back - to the same value. The order of the point in the data set determines which side is considered as front side. If an incorrect ordering is used in the data set, unexpected results may occur (front and back are switched for some or all faces). See also the example section.

set light
set light (int) n (double) alpha, (double) beta, (double) power
set light 0 20.0,30.0,0.6
Set the parameters of a light source. The light sources are used for face drawings with simple light effects (see the command set app for details). n is the number of the light source. Until now three light sources are allowed: n=0,1,2. The angles alpha and beta define the direction incident light. Their scaling is corresponds to that used with the set view command. The parameter power determines the intensity of the light source. A white face with incident light in normal direction and power=1.0 appears at maximum brightness (255,255,255). The default is one light source (n=0) with alpha=0.0, beta=0.0 and power=0.6. See also the light effect section below.

set line_c
set line_c (int) r, (int) g, (int) b
set line_c 255,63,127
Set the color used for line drawings. r, g and b are integers between 0 and 255.

set line_dz
set line_dz (double) dz
set line_dz 0.01
Set the bonus value used for line drawings. See the Z-Buffering section for more details. The value is given relative to the extension of the virtual box (see also set box). The default is dz=0.02. This corresponds to 2 percent of the box extension.

set line_sh
set line_sh (char) key
set line_sh y
Enables (key=y/yes) or disables (key=n/no) the lut-shading of contour lines. If disabled, contour lines a plotted using a fix color. If enabled, the color is computed using a look-up-table.
This command is deprecated. The command set appear should be used.

set line_w
set line_w (int) w
set line_w 2
Set the width of lines. The parameter w gives the value in pixels. This width is used for drawing contour lines, grid lines and the virtual box. The line width value does not effect the drawing of the mesh lines and object edges. Their width is adjusted with the command set edge_w.

set lut
set lut (string) file-name
set lut color.lut
Load the color look-up-table from the given file. See also the lut section.

set null
set null
Reset many parameters to their default values.

set obj_cont
set obj_cont (char) key
set obj_cont y
Enables (key=y/yes) or disables (key=n/no) the plotting of contour lines.
This command is deprecated. The command set appear should be used.

set obj_edge
set obj_edge (char) key
set obj_edge y
Enables (key=y/yes) or disables (key=n/no) the plotting of edges.
This command is deprecated. The command set appear should be used.

set obj_face
set obj_face (char) key
set obj_face y
Enables (key=y/yes) or disables (key=n/no) the plotting of faces.
This command is deprecated. The command set appear should be used.

set out_tol
set out_tol (int) r
set out_tol 250
Set the width of a tolerance zone around the image border. The parameter r gives the width in pixels. When a line is draw, it is checked is the starting and end points are within the image. If one of the points is outside the image, the complete line is discarded. Points in the tolerance zone are considered inside the image. An enlargement of the tolerance zone may slow down the plotting dramatically. When the tolerance zone is too small some lines near the image border may not be drawn. Default is a width of 128 pixels.

set periodic_lut
set periodic_lut (char) key
set periodic_lut y
Enables (key=y/yes) or disables (key=n/no) the periodic continuation of the color look-up-table. In a look-up-table a shade is defined for a limited value range. This option determines the resulting color for a value outside of this range. If 'set periodic_lut no' (default) is given, the resulting color is black. If the periodic lut is enabled, the value is mapped (using a modulo function) inside the limited range and the respective color is returned.

set render_am
set render_am (double) intensity
set render_am 0.3
Set the ambient intensity used when rendering the faces with light effect. intensity should be a value between 0 and 1. A higher value causes the faces to appear brighter. See also the light effect section below.

set shift
set shift (int) dx, (int) dy
set shift -20,10
Shift the 3d-plot by (dx, dy) pixels. Note, that the y-coordinate runs from top to bottom. A negative dy moves the plot up. A negative dx moves the plot left.

set text_bg
set text_bg (int) r, (int) g, (int) b
set text_bg 0,0,255
Set the background color for text drawings. r, g and b are integers between 0 and 255.

set text_fg
set text_fg (int) r, (int) g, (int) b
set text_fg 255,0,0
Set the foreground color for text drawings. r, g and b are integers between 0 and 255.

set using
set using (int) n
set using 5
Select the data-set column from which the values are taken to compute contour-lines or shading values. Default is the value in column 1 which is by default also taken as x-coordinate. See also the set coord command.

set view
set view (double) alpha, (double) beta
set view 20,30
Set the viewing angle for 3d-plots. alpha gives the rotation around the z-axis and beta is the angle with respect to the xy-plane. The command 'set view 0,90' gives a top view with the x-axes from left to right and the y-axis from bottom to top. Together with a flat virtual box the 0,90-setting can be used for 2d-plotting.

set xrange
set yrange
set zrange
set xrange (double) from, (double) to
set xrange -4,4
Set the coordinate-range for the virtual box along the x-axis. This disables the auto-scaling, where the minimum and maximum values of the data set are taken. The auto-scaling can be enabled again by the set auto_r command.

set xticks
set yticks
set zticks
set xticks (int) n
set xticks 4
Set the number of tick-marks along the x-axis.

set zoom
set zoom (double) factor
set zoom 1.2
Scale the 3d-plot by factor.

text
text (int) nx, (int) ny (string) s
text 20,40 "Hello world!"
Write string s at position (nx,ny). Origin is the upper left corner. Strings which contain blanks must be enclosed in quotation marks. The justification of the text is controlled by the set center command.

xaxis
yaxis
zaxis
xaxis (double) ry, (double) rz (int) (string) key
xaxis -1,-1 ct
Draw an axis in x-direction with tick-marks and labels. ry and rz are the y and z-position of the axis in relative box coordinates. These coordinates run from -1 to 1 along each side of the virtual box. key has the same meaning as for the set center command. It controls the justification of the tick-labels. The number of tick-marks is set by the set xticks command.

Virtual box

Pixmax uses three different levels of coordinates:
0.  pixel coordinates
1.  virtual box coordinates
2.  data-set coordinates
The higest level coordinates are denoted by (X2,Y2,Z2). These values correspond directly to the numbers given in the data set. The next level are the so called box coordinates. The virtual box defines a 3d-plotting volume (a quader). All data-drawing is supposed to take place inside this volume. The form of the box determines the appearance of the plot. For example a flat box leads to a shorter z-axis.

All (X2,Y2,Z2) are mapped to (X1,Y1,Z1) coordinates of the virtual box. The transformation between (X2,Y2,Z2) and (X1,Y1,Z1) can be ragared as a rescaling of each coordinate.

The lowest level are the image coordinates (X0,Y0,Z0). The fist two (X0,Y0) corresponds to the pixel position in the image. The third coordinate Z0 gives the distance of the point from the observer. It is used for the z-buffer technique. The transformation between (X1,Y1,Z1) and (X0,Y0,Z0) is done using a perspective projection algorithm.


Z-Buffering

The pixmax program uses the z-buffering technique to do the 3d-plotting. For each pixel in the image not only the color (r,g,b) is stored but also the z-value. This is a floating point number which gives the distance of an 3d-object to the observer. The z-values for all pixels together are called the z-buffer. When a face is drawn the (r,g,b)-values are filled with the face-color. Additionally in the z-buffer the distance from each pixel-point of the face to the observer is stored. If next a line is draw in front of the face, the stored z-values indicate that the line is indeed in front of the face and should be visible. Thus, the z-values are used to decide if a new object (or parts of it) is actually drawn or not.

Accuracy problems occur when a line is draw, which lies exactly in a face. This is a typical case for contour lines and object edges. Then rounding errors can cause the line to be visible at some locations and at others not. This can result in a fractal plot of the line. To overcome this problem a simple measures is taken. All lines get a certain bonus. This means, a fix z-bonus (dz) is subtracted from their actual z-value. So they appear always in front of the faces. The z-bonus can be adjusted by the set line_dz command.

Unfortunately the simple bonus-trick has a drawback. If the z-bonus is too large lines appear in front of the faces where they should not be visible. Thus, the chosen z-bonus has to be a compromise between fractal line drawings and invalid line drawing in front of faces. Mostly the default value gives acceptable results.


Light effect

To draw faces a simple light effect can be used. The brightness of the face is computed using the face normal vector and the direction of incoming light. Up to 3 different light sources (directions) are possible. The are set up by the set light command. The ambient brightness is set by the set render_am command. When the normal vector and the light direction are parallel the face gets full brightness. The set app command controls, if the light effect is used. See also the example section.
back