BRL-CAD

The basic UNIX-plot routines. More...

Collaboration diagram for Plotting:

Files

file  plot3.h
 
file  tig.h
 

Macros

#define pl_mat_idn(_mat)   MAT_IDN( _mat )
 
#define pl_mat_zero(_mat)   MAT_ZERO( _mat )
 
#define pl_mat_copy(_mat1, _mat2)   MAT_COPY( _mat1, _mat2 )
 
#define PL_OUTPUT_MODE_BINARY   0
 
#define PL_OUTPUT_MODE_TEXT   1
 
#define PL_FORTRAN(lc, uc)   BU_FORTRAN(lc, uc)
 

Functions

int pl_getOutputMode (void)
 
void pl_setOutputMode (int mode)
 
void pl_point (FILE *plotfp, int x, int y)
 
void pl_line (FILE *plotfp, int fx, int fy, int tx, int ty)
 
void pl_linmod (FILE *plotfp, const char *s)
 
void pl_move (FILE *plotfp, int x, int y)
 
void pl_cont (FILE *plotfp, int x, int y)
 
void pl_label (FILE *plotfp, const char *s)
 
void pl_space (FILE *plotfp, int x_1, int y_1, int x_2, int y_2)
 
void pl_erase (FILE *plotfp)
 
void pl_circle (FILE *plotfp, int x, int y, int r)
 
void pl_arc (FILE *plotfp, int xc, int yc, int x_1, int y_1, int x_2, int y_2)
 
void pl_box (FILE *plotfp, int x_1, int y_1, int x_2, int y_2)
 
void pl_color (FILE *plotfp, int r, int g, int b)
 
void pl_color_buc (FILE *plotfp, struct bu_color *c)
 
void pl_flush (FILE *plotfp)
 
void pl_3space (FILE *plotfp, int x_1, int y_1, int z_1, int x_2, int y_2, int z_2)
 
void pl_3point (FILE *plotfp, int x, int y, int z)
 
void pl_3move (FILE *plotfp, int x, int y, int z)
 
void pl_3cont (FILE *plotfp, int x, int y, int z)
 
void pl_3line (FILE *plotfp, int x_1, int y_1, int z_1, int x_2, int y_2, int z_2)
 
void pl_3box (FILE *plotfp, int x_1, int y_1, int z_1, int x_2, int y_2, int z_2)
 
void pd_point (FILE *plotfp, double x, double y)
 
void pd_line (FILE *plotfp, double fx, double fy, double tx, double ty)
 
void pd_move (FILE *plotfp, double x, double y)
 
void pd_cont (FILE *plotfp, double x, double y)
 
void pd_space (FILE *plotfp, double x_1, double y_1, double x_2, double y_2)
 
void pd_circle (FILE *plotfp, double x, double y, double r)
 
void pd_arc (FILE *plotfp, double xc, double yc, double x_1, double y_1, double x_2, double y_2)
 
void pd_box (FILE *plotfp, double x_1, double y_1, double x_2, double y_2)
 
void pd_3space (FILE *plotfp, double x_1, double y_1, double z_1, double x_2, double y_2, double z_2)
 
void pd_3point (FILE *plotfp, double x, double y, double z)
 
void pd_3move (FILE *plotfp, double x, double y, double z)
 
void pd_3cont (FILE *plotfp, double x, double y, double z)
 
void pd_3line (FILE *plotfp, double x_1, double y_1, double z_1, double x_2, double y_2, double z_2)
 
void pd_3box (FILE *plotfp, double x_1, double y_1, double z_1, double x_2, double y_2, double z_2)
 
void pdv_3ray (FILE *fp, const point_t pt, const vect_t dir, double t)
 
int plot3_invalid (FILE *fp, int mode)
 
void tp_i2list (FILE *fp, int *x, int *y, int npoints)
 
void tp_2list (FILE *fp, double *x, double *y, int npoints)
 
void BU_FORTRAN (f2list, F2LIST)(FILE **fpp
 
void tp_3list (FILE *fp, double *x, double *y, double *z, int npoints)
 
void BU_FORTRAN (f3list, F3LIST)(FILE **fpp
 
void tp_2mlist (FILE *fp, double *x, double *y, int npoints, int flag, int mark, int interval, double size)
 
void BU_FORTRAN (f2mlst, F2MLST)(FILE **fp
 
void tp_2marker (FILE *fp, int c, double x, double y, double scale)
 
void BU_FORTRAN (f2mark, F2MARK)(FILE **fp
 
void tp_3marker (FILE *fp, int c, double x, double y, double z, double scale)
 
void BU_FORTRAN (f3mark, F3MARK)(FILE **fp
 
void tp_2number (FILE *fp, double input, int x, int y, int cscale, double theta, int digits)
 
void BU_FORTRAN (f2numb, F2NUMB)(FILE **fp
 
void tp_scale (int idata[], int elements, int mode, int length, int odata[], double *min, double *dx)
 
void BU_FORTRAN (fscale, FSCALE)(int idata[]
 
void tp_2symbol (FILE *fp, char *string, double x, double y, double scale, double theta)
 
void BU_FORTRAN (f2symb, F2SYMB)(FILE **fp
 
void tp_plot (FILE *fp, int xp, int yp, int xl, int yl, char xtitle[], char ytitle[], float x[], float y[], int n, double cscale)
 
void BU_FORTRAN (fplot, FPLOT)(FILE **fp
 
void tp_ftoa (float x, char *s)
 
void tp_fixsc (float *x, int npts, float size, float *xs, float *xmin, float *xmax, float *dx)
 
void tp_sep (float x, float *coef, int *ex)
 
double tp_ipow (double x, int n)
 
void tp_3axis (FILE *fp, char *string, point_t origin, mat_t rot, double length, int ccw, int ndigits, double label_start, double label_incr, double tick_separation, double char_width)
 
void BU_FORTRAN (f3axis, F3AXIS)(FILE **fp
 
void tp_3symbol (FILE *fp, char *string, point_t origin, mat_t rot, double scale)
 
void tp_3vector (FILE *plotfp, point_t from, point_t to, double fromheadfract, double toheadfract)
 
void BU_FORTRAN (f3vect, F3VECT)(FILE **fp
 

Variables

void float * x
 
void float float * y
 
void float float int * n
 
void float float float * z
 
void float float int * np
 
void float float int int * flag
 
void float float int int int * mark
 
void float float int int int int * interval
 
void float float int int int int float * size
 
void int * c
 
void int float float float * scale
 
void float * input
 
void float int int float * cscale
 
void float int int float float * theta
 
void float int int float float int * digits
 
void int * elements
 
void int char * mode
 
void int char int * length
 
void int char int int odata []
 
void int char int int double * min
 
void int char int int double double * dx
 
void char * string
 
void int * xp
 
void int int * yp
 
void int int int * xl
 
void int int int int * yl
 
void int int int int char * xtitle
 
void int int int int char char * ytitle
 
void char float float float float float int * ccw
 
void char float float float float float int int * ndigits
 
void char float float float float float int int float * label_start
 
void char float float float float float int int float float * label_incr
 
void char float float float float float int int float float float * tick_separation
 
void char float float float float float int int float float float float * char_width
 
void float * fx
 
void float float * fy
 
void float float float * fz
 
void float float float float * tx
 
void float float float float float * ty
 
void float float float float float float * tz
 
void float float float float float float float * fl
 
void float float float float float float float float * tl
 

Detailed Description

The basic UNIX-plot routines.

The calling sequence is the same as the original Bell Labs routines, with the exception of the pl_ prefix on the name.

Of interest: the Plan 9 sources (recently MIT licensed) appear to be related to the original code that would have formed the conceptual basis for these routines:

https://plan9.io/sources/plan9/sys/src/cmd/plot/libplot/

Don't know if there would be any improvements that could be retrofitted onto this version, but might be worth looking. In particular, curious if the spline routine might be useful...

The following routines are taken from the BRL TIG-PACK (Terminal Independent Plotting Package). These routines create plots by using the pl_() and pd_() routines declared in plot3.h.

Macro Definition Documentation

◆ pl_mat_idn

#define pl_mat_idn (   _mat)    MAT_IDN( _mat )

Definition at line 51 of file plot3.h.

◆ pl_mat_zero

#define pl_mat_zero (   _mat)    MAT_ZERO( _mat )

Definition at line 52 of file plot3.h.

◆ pl_mat_copy

#define pl_mat_copy (   _mat1,
  _mat2 
)    MAT_COPY( _mat1, _mat2 )

Definition at line 53 of file plot3.h.

◆ PL_OUTPUT_MODE_BINARY

#define PL_OUTPUT_MODE_BINARY   0

Definition at line 55 of file plot3.h.

◆ PL_OUTPUT_MODE_TEXT

#define PL_OUTPUT_MODE_TEXT   1

Definition at line 56 of file plot3.h.

◆ PL_FORTRAN

#define PL_FORTRAN (   lc,
  uc 
)    BU_FORTRAN(lc, uc)

Definition at line 45 of file tig.h.

Function Documentation

◆ pl_getOutputMode()

int pl_getOutputMode ( void  )

◆ pl_setOutputMode()

void pl_setOutputMode ( int  mode)

◆ pl_point()

void pl_point ( FILE *  plotfp,
int  x,
int  y 
)

◆ pl_line()

void pl_line ( FILE *  plotfp,
int  fx,
int  fy,
int  tx,
int  ty 
)

◆ pl_linmod()

void pl_linmod ( FILE *  plotfp,
const char *  s 
)

◆ pl_move()

void pl_move ( FILE *  plotfp,
int  x,
int  y 
)

◆ pl_cont()

void pl_cont ( FILE *  plotfp,
int  x,
int  y 
)

◆ pl_label()

void pl_label ( FILE *  plotfp,
const char *  s 
)

◆ pl_space()

void pl_space ( FILE *  plotfp,
int  x_1,
int  y_1,
int  x_2,
int  y_2 
)

◆ pl_erase()

void pl_erase ( FILE *  plotfp)

◆ pl_circle()

void pl_circle ( FILE *  plotfp,
int  x,
int  y,
int  r 
)

◆ pl_arc()

void pl_arc ( FILE *  plotfp,
int  xc,
int  yc,
int  x_1,
int  y_1,
int  x_2,
int  y_2 
)

◆ pl_box()

void pl_box ( FILE *  plotfp,
int  x_1,
int  y_1,
int  x_2,
int  y_2 
)

◆ pl_color()

void pl_color ( FILE *  plotfp,
int  r,
int  g,
int  b 
)

◆ pl_color_buc()

void pl_color_buc ( FILE *  plotfp,
struct bu_color c 
)

◆ pl_flush()

void pl_flush ( FILE *  plotfp)

◆ pl_3space()

void pl_3space ( FILE *  plotfp,
int  x_1,
int  y_1,
int  z_1,
int  x_2,
int  y_2,
int  z_2 
)

◆ pl_3point()

void pl_3point ( FILE *  plotfp,
int  x,
int  y,
int  z 
)

◆ pl_3move()

void pl_3move ( FILE *  plotfp,
int  x,
int  y,
int  z 
)

◆ pl_3cont()

void pl_3cont ( FILE *  plotfp,
int  x,
int  y,
int  z 
)

◆ pl_3line()

void pl_3line ( FILE *  plotfp,
int  x_1,
int  y_1,
int  z_1,
int  x_2,
int  y_2,
int  z_2 
)

◆ pl_3box()

void pl_3box ( FILE *  plotfp,
int  x_1,
int  y_1,
int  z_1,
int  x_2,
int  y_2,
int  z_2 
)

◆ pd_point()

void pd_point ( FILE *  plotfp,
double  x,
double  y 
)

◆ pd_line()

void pd_line ( FILE *  plotfp,
double  fx,
double  fy,
double  tx,
double  ty 
)

◆ pd_move()

void pd_move ( FILE *  plotfp,
double  x,
double  y 
)

◆ pd_cont()

void pd_cont ( FILE *  plotfp,
double  x,
double  y 
)

◆ pd_space()

void pd_space ( FILE *  plotfp,
double  x_1,
double  y_1,
double  x_2,
double  y_2 
)

◆ pd_circle()

void pd_circle ( FILE *  plotfp,
double  x,
double  y,
double  r 
)

◆ pd_arc()

void pd_arc ( FILE *  plotfp,
double  xc,
double  yc,
double  x_1,
double  y_1,
double  x_2,
double  y_2 
)

◆ pd_box()

void pd_box ( FILE *  plotfp,
double  x_1,
double  y_1,
double  x_2,
double  y_2 
)

◆ pd_3space()

void pd_3space ( FILE *  plotfp,
double  x_1,
double  y_1,
double  z_1,
double  x_2,
double  y_2,
double  z_2 
)

◆ pd_3point()

void pd_3point ( FILE *  plotfp,
double  x,
double  y,
double  z 
)

◆ pd_3move()

void pd_3move ( FILE *  plotfp,
double  x,
double  y,
double  z 
)

◆ pd_3cont()

void pd_3cont ( FILE *  plotfp,
double  x,
double  y,
double  z 
)

◆ pd_3line()

void pd_3line ( FILE *  plotfp,
double  x_1,
double  y_1,
double  z_1,
double  x_2,
double  y_2,
double  z_2 
)

◆ pd_3box()

void pd_3box ( FILE *  plotfp,
double  x_1,
double  y_1,
double  z_1,
double  x_2,
double  y_2,
double  z_2 
)

◆ pdv_3ray()

void pdv_3ray ( FILE *  fp,
const point_t  pt,
const vect_t  dir,
double  t 
)

◆ plot3_invalid()

int plot3_invalid ( FILE *  fp,
int  mode 
)

◆ tp_i2list()

void tp_i2list ( FILE *  fp,
int *  x,
int *  y,
int  npoints 
)

Take a set of x, y coordinates, and plot them as a polyline, i.e., connect them with line segments. For markers, use tp_mlist(), below. This "C" interface expects arrays of INTs.

◆ tp_2list()

void tp_2list ( FILE *  fp,
double *  x,
double *  y,
int  npoints 
)

Take a set of x, y coordinates, and plot them as a polyline, i.e., connect them with line segments. For markers, use tp_mlist(), below. This "C" interface expects arrays of DOUBLES.

NOTE: tp_2list() and tp_3list() are good candidates to become intrinsic parts of plot3.c, for efficiency reasons.

Originally written in August 04, 1978

◆ BU_FORTRAN() [1/11]

void BU_FORTRAN ( f2list  ,
F2LIST   
)

◆ tp_3list()

void tp_3list ( FILE *  fp,
double *  x,
double *  y,
double *  z,
int  npoints 
)

NOTE: tp_2list() and tp_3list() are good candidates to become intrinsic parts of plot3.c, for efficiency reasons.

Originally written in August 04, 1978

◆ BU_FORTRAN() [2/11]

void BU_FORTRAN ( f3list  ,
F3LIST   
)

◆ tp_2mlist()

void tp_2mlist ( FILE *  fp,
double *  x,
double *  y,
int  npoints,
int  flag,
int  mark,
int  interval,
double  size 
)

Take a set of x, y co-ordinates and plots them, with a combination of connecting lines and/or place markers. It is important to note that the arrays are arrays of doubles, and express UNIX-plot coordinates in the current pl_space().

tp_scale(TIG) may be called first to optionally re-scale the data.

The 'mark' character to be used for marking points off can be any printing ASCII character, or 001 to 005 for the special marker characters.

In addition, the value of the 'flag' variable determines the type of line to be drawn, as follows:

  • 0 Draw nothing (rather silly)
  • 1 Marks only, no connecting lines. Suggested interval=1.
  • 2 Draw connecting lines only.
  • 3 Draw line and marks

◆ BU_FORTRAN() [3/11]

void BU_FORTRAN ( f2mlst  ,
F2MLST   
)

This FORTRAN interface expects arrays of REALs (single precision).

◆ tp_2marker()

void tp_2marker ( FILE *  fp,
int  c,
double  x,
double  y,
double  scale 
)

◆ BU_FORTRAN() [4/11]

void BU_FORTRAN ( f2mark  ,
F2MARK   
)

◆ tp_3marker()

void tp_3marker ( FILE *  fp,
int  c,
double  x,
double  y,
double  z,
double  scale 
)

◆ BU_FORTRAN() [5/11]

void BU_FORTRAN ( f3mark  ,
F3MARK   
)

◆ tp_2number()

void tp_2number ( FILE *  fp,
double  input,
int  x,
int  y,
int  cscale,
double  theta,
int  digits 
)

◆ BU_FORTRAN() [6/11]

void BU_FORTRAN ( f2numb  ,
F2NUMB   
)

◆ tp_scale()

void tp_scale ( int  idata[],
int  elements,
int  mode,
int  length,
int  odata[],
double *  min,
double *  dx 
)

◆ BU_FORTRAN() [7/11]

void BU_FORTRAN ( fscale  ,
FSCALE   
)

◆ tp_2symbol()

void tp_2symbol ( FILE *  fp,
char *  string,
double  x,
double  y,
double  scale,
double  theta 
)

◆ BU_FORTRAN() [8/11]

void BU_FORTRAN ( f2symb  ,
F2SYMB   
)

◆ tp_plot()

void tp_plot ( FILE *  fp,
int  xp,
int  yp,
int  xl,
int  yl,
char  xtitle[],
char  ytitle[],
float  x[],
float  y[],
int  n,
double  cscale 
)

◆ BU_FORTRAN() [9/11]

void BU_FORTRAN ( fplot  ,
FPLOT   
)

◆ tp_ftoa()

void tp_ftoa ( float  x,
char *  s 
)

◆ tp_fixsc()

void tp_fixsc ( float *  x,
int  npts,
float  size,
float *  xs,
float *  xmin,
float *  xmax,
float *  dx 
)

◆ tp_sep()

void tp_sep ( float  x,
float *  coef,
int *  ex 
)

◆ tp_ipow()

double tp_ipow ( double  x,
int  n 
)

◆ tp_3axis()

void tp_3axis ( FILE *  fp,
char *  string,
point_t  origin,
mat_t  rot,
double  length,
int  ccw,
int  ndigits,
double  label_start,
double  label_incr,
double  tick_separation,
double  char_width 
)

This routine is used to generate an axis for a graph. It draws an axis with a linear scale, places tic marks every inch, labels the tics, and uses the supplied title for the axis.

The strategy behind this routine is to split the axis into SEGMENTS, which run from one tick to the next. The origin of the first segment (x, y), the origin of the bottom of the first tick (xbott, ybott), and the origin of the first tick label (xnum, ynum) are computed along with the delta x and delta y (xincr, yincr) which describes the interval to the start of the next tick.

Originally written on August 01, 1978

◆ BU_FORTRAN() [10/11]

void BU_FORTRAN ( f3axis  ,
F3AXIS   
)

◆ tp_3symbol()

void tp_3symbol ( FILE *  fp,
char *  string,
point_t  origin,
mat_t  rot,
double  scale 
)

◆ tp_3vector()

void tp_3vector ( FILE *  plotfp,
point_t  from,
point_t  to,
double  fromheadfract,
double  toheadfract 
)

◆ BU_FORTRAN() [11/11]

void BU_FORTRAN ( f3vect  ,
F3VECT   
)

Variable Documentation

◆ x

void char float * x

Definition at line 72 of file tig.h.

Referenced by mat2d_pt2d_mul().

◆ y

void char float float * y

Definition at line 73 of file tig.h.

Referenced by mat2d_pt2d_mul().

◆ n

void int int int int char char float float int * n

Definition at line 74 of file tig.h.

◆ z

void char float float float * z

Definition at line 90 of file tig.h.

◆ np

void float float int* np

Definition at line 128 of file tig.h.

◆ flag

void float float int int* flag

Definition at line 129 of file tig.h.

◆ mark

void float float int int int* mark

Definition at line 130 of file tig.h.

◆ interval

void float float int int int int* interval

Definition at line 131 of file tig.h.

◆ size

void float float int int int int float* size

Definition at line 132 of file tig.h.

Referenced by PooledObject< T >::operator new().

◆ c

void int * c

Definition at line 139 of file tig.h.

Referenced by mat2d_inverse(), and mat2d_pt2d_mul().

◆ scale

void char float float float * scale

Definition at line 142 of file tig.h.

Referenced by mat2d_inverse().

◆ input

void float* input

Definition at line 163 of file tig.h.

◆ cscale

void int int int int char char float float int float * cscale

Definition at line 166 of file tig.h.

◆ theta

void char float float float float float * theta

Definition at line 167 of file tig.h.

◆ digits

void float int int float float int* digits

Definition at line 168 of file tig.h.

◆ elements

void int* elements

Definition at line 178 of file tig.h.

◆ mode

void int char* mode

Definition at line 179 of file tig.h.

◆ length

void char float float float float * length

Definition at line 180 of file tig.h.

◆ odata

void int char int int odata[]

Definition at line 181 of file tig.h.

◆ min

void int char int int double* min

Definition at line 182 of file tig.h.

Referenced by BRNode::GetBBox(), and BBNode::GetBBox().

◆ dx

void int char int int double double* dx

Definition at line 183 of file tig.h.

◆ string

void char * string

Definition at line 191 of file tig.h.

◆ xp

void int* xp

Definition at line 208 of file tig.h.

◆ yp

void int int* yp

Definition at line 209 of file tig.h.

◆ xl

void int int int* xl

Definition at line 210 of file tig.h.

◆ yl

void int int int int* yl

Definition at line 211 of file tig.h.

◆ xtitle

void int int int int char* xtitle

Definition at line 212 of file tig.h.

◆ ytitle

void int int int int char char* ytitle

Definition at line 213 of file tig.h.

◆ ccw

void char float float float float float int* ccw

Definition at line 265 of file tig.h.

◆ ndigits

void char float float float float float int int* ndigits

Definition at line 266 of file tig.h.

◆ label_start

void char float float float float float int int float* label_start

Definition at line 267 of file tig.h.

◆ label_incr

void char float float float float float int int float float* label_incr

Definition at line 268 of file tig.h.

◆ tick_separation

void char float float float float float int int float float float* tick_separation

Definition at line 269 of file tig.h.

◆ char_width

void char float float float float float int int float float float float* char_width

Definition at line 270 of file tig.h.

◆ fx

void float* fx

Definition at line 282 of file tig.h.

◆ fy

void float float* fy

Definition at line 283 of file tig.h.

◆ fz

void float float float* fz

Definition at line 284 of file tig.h.

◆ tx

void float float float float* tx

Definition at line 285 of file tig.h.

◆ ty

void float float float float float* ty

Definition at line 286 of file tig.h.

◆ tz

void float float float float float float* tz

Definition at line 287 of file tig.h.

◆ fl

void float float float float float float float* fl

Definition at line 288 of file tig.h.

◆ tl

void float float float float float float float float* tl

Definition at line 289 of file tig.h.