BRL-CAD
tig.h
Go to the documentation of this file.
1/* T I G . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2023 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup bv_plot
21 *
22 * The following routines are taken from the BRL TIG-PACK
23 * (Terminal Independent Plotting Package).
24 * These routines create plots by using the pl_() and pd_() routines
25 * declared in plot3.h.
26 *
27 */
28/** @{ */
29/** @file tig.h */
30
31#ifndef BV_TIG_H
32#define BV_TIG_H
33
34#include "common.h"
35
36#include "vmath.h"
37#include "bu/defines.h"
38#include "bu/color.h"
39#include "bu/file.h"
40#include "bv/defines.h"
41#include "bv/plot3.h"
42
43__BEGIN_DECLS
44
45#define PL_FORTRAN(lc, uc) BU_FORTRAN(lc, uc)
46
47/**
48 * Take a set of x, y coordinates, and plot them as a polyline, i.e.,
49 * connect them with line segments. For markers, use tp_mlist(),
50 * below. This "C" interface expects arrays of INTs.
51 */
52BV_EXPORT extern void tp_i2list(FILE *fp,
53 int *x,
54 int *y,
55 int npoints);
56
57/**
58 * Take a set of x, y coordinates, and plot them as a polyline, i.e.,
59 * connect them with line segments. For markers, use tp_mlist(),
60 * below. This "C" interface expects arrays of DOUBLES.
61 *
62 * NOTE: tp_2list() and tp_3list() are good candidates to become
63 * intrinsic parts of plot3.c, for efficiency reasons.
64 *
65 * Originally written in August 04, 1978
66 */
67BV_EXPORT extern void tp_2list(FILE *fp,
68 double *x,
69 double *y,
70 int npoints);
71BV_EXPORT extern void BU_FORTRAN(f2list, F2LIST)(FILE **fpp,
72 float *x,
73 float *y,
74 int *n);
75
76/**
77 * NOTE: tp_2list() and tp_3list() are good candidates to become
78 * intrinsic parts of plot3.c, for efficiency reasons.
79 *
80 * Originally written in August 04, 1978
81 */
82BV_EXPORT extern void tp_3list(FILE *fp,
83 double *x,
84 double *y,
85 double *z,
86 int npoints);
87BV_EXPORT extern void BU_FORTRAN(f3list, F3LIST)(FILE **fpp,
88 float *x,
89 float *y,
90 float *z,
91 int *n);
92
93/**
94 * Take a set of x, y co-ordinates and plots them, with a combination
95 * of connecting lines and/or place markers. It is important to note
96 * that the arrays are arrays of doubles, and express UNIX-plot
97 * coordinates in the current pl_space().
98 *
99 * tp_scale(TIG) may be called first to optionally re-scale the data.
100 *
101 * The 'mark' character to be used for marking points off can be any
102 * printing ASCII character, or 001 to 005 for the special marker
103 * characters.
104 *
105 * In addition, the value of the 'flag' variable determines the type
106 * of line to be drawn, as follows:
107 *
108 *@li 0 Draw nothing (rather silly)
109 *@li 1 Marks only, no connecting lines. Suggested interval=1.
110 *@li 2 Draw connecting lines only.
111 *@li 3 Draw line and marks
112 */
113BV_EXPORT extern void tp_2mlist(FILE *fp,
114 double *x,
115 double *y,
116 int npoints,
117 int flag,
118 int mark,
119 int interval,
120 double size);
121
122/**
123 * This FORTRAN interface expects arrays of REALs (single precision).
124 */
125BV_EXPORT extern void BU_FORTRAN(f2mlst, F2MLST)(FILE **fp,
126 float *x,
127 float *y,
128 int *np,
129 int *flag,
130 int *mark,
132 float *size);
133BV_EXPORT extern void tp_2marker(FILE *fp,
134 int c,
135 double x,
136 double y,
137 double scale);
138BV_EXPORT extern void BU_FORTRAN(f2mark, F2MARK)(FILE **fp,
139 int *c,
140 float *x,
141 float *y,
142 float *scale);
143BV_EXPORT extern void tp_3marker(FILE *fp,
144 int c,
145 double x,
146 double y,
147 double z,
148 double scale);
149BV_EXPORT extern void BU_FORTRAN(f3mark, F3MARK)(FILE **fp,
150 int *c,
151 float *x,
152 float *y,
153 float *z,
154 float *scale);
155BV_EXPORT extern void tp_2number(FILE *fp,
156 double input,
157 int x,
158 int y,
159 int cscale,
160 double theta,
161 int digits);
162BV_EXPORT extern void BU_FORTRAN(f2numb, F2NUMB)(FILE **fp,
163 float *input,
164 int *x,
165 int *y,
166 float *cscale,
167 float *theta,
168 int *digits);
169BV_EXPORT extern void tp_scale(int idata[],
170 int elements,
171 int mode,
172 int length,
173 int odata[],
174 double *min,
175 double *dx);
176
177BV_EXPORT extern void BU_FORTRAN(fscale, FSCALE)(int idata[],
179 char *mode,
180 int *length,
181 int odata[],
182 double *min,
183 double *dx);
184BV_EXPORT extern void tp_2symbol(FILE *fp,
185 char *string,
186 double x,
187 double y,
188 double scale,
189 double theta);
190BV_EXPORT extern void BU_FORTRAN(f2symb, F2SYMB)(FILE **fp,
191 char *string,
192 float *x,
193 float *y,
194 float *scale,
195 float *theta);
196BV_EXPORT extern void tp_plot(FILE *fp,
197 int xp,
198 int yp,
199 int xl,
200 int yl,
201 char xtitle[],
202 char ytitle[],
203 float x[],
204 float y[],
205 int n,
206 double cscale);
207BV_EXPORT extern void BU_FORTRAN(fplot, FPLOT)(FILE **fp,
208 int *xp,
209 int *yp,
210 int *xl,
211 int *yl,
212 char *xtitle,
213 char *ytitle,
214 float *x,
215 float *y,
216 int *n,
217 float *cscale);
218BV_EXPORT extern void tp_ftoa(float x, char *s);
219BV_EXPORT extern void tp_fixsc(float *x,
220 int npts,
221 float size,
222 float *xs,
223 float *xmin,
224 float *xmax,
225 float *dx);
226BV_EXPORT extern void tp_sep(float x,
227 float *coef,
228 int *ex);
229BV_EXPORT extern double tp_ipow(double x,
230 int n);
231
232
233/**
234 * This routine is used to generate an axis for a graph. It draws an
235 * axis with a linear scale, places tic marks every inch, labels the
236 * tics, and uses the supplied title for the axis.
237 *
238 * The strategy behind this routine is to split the axis into
239 * SEGMENTS, which run from one tick to the next. The origin of the
240 * first segment (x, y), the origin of the bottom of the first tick
241 * (xbott, ybott), and the origin of the first tick label (xnum, ynum)
242 * are computed along with the delta x and delta y (xincr, yincr)
243 * which describes the interval to the start of the next tick.
244 *
245 * Originally written on August 01, 1978
246 */
247BV_EXPORT extern void tp_3axis(FILE *fp,
248 char *string,
249 point_t origin,
250 mat_t rot,
251 double length,
252 int ccw,
253 int ndigits,
254 double label_start,
255 double label_incr,
256 double tick_separation,
257 double char_width);
258BV_EXPORT extern void BU_FORTRAN(f3axis, F3AXIS)(FILE **fp,
259 char *string,
260 float *x,
261 float *y,
262 float *z,
263 float *length,
264 float *theta,
265 int *ccw,
270 float *char_width);
271BV_EXPORT extern void tp_3symbol(FILE *fp,
272 char *string,
273 point_t origin,
274 mat_t rot,
275 double scale);
276BV_EXPORT extern void tp_3vector(FILE *plotfp,
277 point_t from,
278 point_t to,
279 double fromheadfract,
280 double toheadfract);
281BV_EXPORT extern void BU_FORTRAN(f3vect, F3VECT)(FILE **fp,
282 float *fx,
283 float *fy,
284 float *fz,
285 float *tx,
286 float *ty,
287 float *tz,
288 float *fl,
289 float *tl);
290
291__END_DECLS
292
293#endif /* BV_TIG_H */
294
295/** @} */
296/*
297 * Local Variables:
298 * mode: C
299 * tab-width: 8
300 * indent-tabs-mode: t
301 * c-file-style: "stroustrup"
302 * End:
303 * ex: shiftwidth=4 tabstop=8
304 */
Header file for the BRL-CAD common definitions.
void float float float float float float float float * tl
Definition: tig.h:289
void char float float float float float int * ccw
Definition: tig.h:265
void float float * fy
Definition: tig.h:283
void float float int int * flag
Definition: tig.h:129
void tp_2mlist(FILE *fp, double *x, double *y, int npoints, int flag, int mark, int interval, double size)
void int * elements
Definition: tig.h:178
void char float float float float float int int float float float * tick_separation
Definition: tig.h:269
void float int int float float * theta
Definition: tig.h:167
void tp_scale(int idata[], int elements, int mode, int length, int odata[], double *min, double *dx)
void int int * yp
Definition: tig.h:209
void tp_2list(FILE *fp, double *x, double *y, int npoints)
void BU_FORTRAN(f2list, F2LIST)(FILE **fpp
void float float float * fz
Definition: tig.h:284
void int float float float * scale
Definition: tig.h:142
void tp_2number(FILE *fp, double input, int x, int y, int cscale, double theta, int digits)
void tp_2symbol(FILE *fp, char *string, double x, double y, double scale, double theta)
void float float int * n
Definition: tig.h:74
void int * xp
Definition: tig.h:208
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 tp_fixsc(float *x, int npts, float size, float *xs, float *xmin, float *xmax, float *dx)
void float float int int int int * interval
Definition: tig.h:131
void int int int * xl
Definition: tig.h:210
void float float * y
Definition: tig.h:73
void char float float float float float int int float float float float * char_width
Definition: tig.h:270
void float int int float * cscale
Definition: tig.h:166
void tp_3marker(FILE *fp, int c, double x, double y, double z, double scale)
void float float float float * tx
Definition: tig.h:285
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 float float int int int * mark
Definition: tig.h:130
void int char * mode
Definition: tig.h:179
void float float int int int int float * size
Definition: tig.h:132
void int char int int double * min
Definition: tig.h:182
void int int int int char * xtitle
Definition: tig.h:212
void float * fx
Definition: tig.h:282
void float float float float float float * tz
Definition: tig.h:287
void tp_ftoa(float x, char *s)
void char float float float float float int int * ndigits
Definition: tig.h:266
void float float int * np
Definition: tig.h:128
void int char int int odata[]
Definition: tig.h:181
void float float float float float * ty
Definition: tig.h:286
void tp_3list(FILE *fp, double *x, double *y, double *z, int npoints)
void char * string
Definition: tig.h:191
void float float float * z
Definition: tig.h:90
void int int int int * yl
Definition: tig.h:211
void int * c
Definition: tig.h:139
void int char int * length
Definition: tig.h:180
void tp_2marker(FILE *fp, int c, double x, double y, double scale)
void tp_sep(float x, float *coef, int *ex)
void float * input
Definition: tig.h:163
void float int int float float int * digits
Definition: tig.h:168
void char float float float float float int int float float * label_incr
Definition: tig.h:268
void char float float float float float int int float * label_start
Definition: tig.h:267
void tp_3symbol(FILE *fp, char *string, point_t origin, mat_t rot, double scale)
void float float float float float float float * fl
Definition: tig.h:288
void float * x
Definition: tig.h:72
void int int int int char char * ytitle
Definition: tig.h:213
void tp_i2list(FILE *fp, int *x, int *y, int npoints)
double tp_ipow(double x, int n)
void int char int int double double * dx
Definition: tig.h:183
void tp_3vector(FILE *plotfp, point_t from, point_t to, double fromheadfract, double toheadfract)
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:366
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
fundamental vector, matrix, quaternion math macros