BRL-CAD
plot3.h
Go to the documentation of this file.
1/* P L O T 3 . 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 calling sequence is the same as the original Bell Labs routines, with
23 * the exception of the pl_ prefix on the name.
24 *
25 * Of interest: the Plan 9 sources (recently MIT licensed) appear to be
26 * related to the original code that would have formed the conceptual basis for
27 * these routines:
28 *
29 * https://plan9.io/sources/plan9/sys/src/cmd/plot/libplot/
30 *
31 * Don't know if there would be any improvements that could be retrofitted onto
32 * this version, but might be worth looking. In particular, curious if the
33 * spline routine might be useful...
34 */
35/** @{ */
36/** @file plot3.h */
37
38#ifndef BV_PLOT3_H
39#define BV_PLOT3_H
40
41#include "common.h"
42
43#include "vmath.h"
44#include "bu/defines.h"
45#include "bu/color.h"
46#include "bu/file.h"
47#include "bv/defines.h"
48
49__BEGIN_DECLS
50
51#define pl_mat_idn( _mat ) MAT_IDN( _mat )
52#define pl_mat_zero( _mat ) MAT_ZERO( _mat )
53#define pl_mat_copy( _mat1, _mat2 ) MAT_COPY( _mat1, _mat2 )
54
55#define PL_OUTPUT_MODE_BINARY 0
56#define PL_OUTPUT_MODE_TEXT 1
57
58
59BV_EXPORT extern int pl_getOutputMode(void);
60BV_EXPORT extern void pl_setOutputMode(int mode);
61BV_EXPORT extern void pl_point(FILE *plotfp,
62 int x,
63 int y);
64BV_EXPORT extern void pl_line(FILE *plotfp,
65 int fx,
66 int fy,
67 int tx,
68 int ty);
69BV_EXPORT extern void pl_linmod(FILE *plotfp,
70 const char *s);
71BV_EXPORT extern void pl_move(FILE *plotfp,
72 int x,
73 int y);
74BV_EXPORT extern void pl_cont(FILE *plotfp,
75 int x,
76 int y);
77BV_EXPORT extern void pl_label(FILE *plotfp,
78 const char *s);
79BV_EXPORT extern void pl_space(FILE *plotfp,
80 int x_1,
81 int y_1,
82 int x_2,
83 int y_2);
84BV_EXPORT extern void pl_erase(FILE *plotfp);
85BV_EXPORT extern void pl_circle(FILE *plotfp,
86 int x,
87 int y,
88 int r);
89BV_EXPORT extern void pl_arc(FILE *plotfp,
90 int xc,
91 int yc,
92 int x_1,
93 int y_1,
94 int x_2,
95 int y_2);
96BV_EXPORT extern void pl_box(FILE *plotfp,
97 int x_1,
98 int y_1,
99 int x_2,
100 int y_2);
101
102/*
103 * BRL extensions to the UNIX-plot file format.
104 */
105BV_EXPORT extern void pl_color(FILE *plotfp,
106 int r,
107 int g,
108 int b);
109BV_EXPORT extern void pl_color_buc(FILE *plotfp,
110 struct bu_color *c);
111BV_EXPORT extern void pl_flush(FILE *plotfp);
112BV_EXPORT extern void pl_3space(FILE *plotfp,
113 int x_1,
114 int y_1,
115 int z_1,
116 int x_2,
117 int y_2,
118 int z_2);
119BV_EXPORT extern void pl_3point(FILE *plotfp,
120 int x,
121 int y,
122 int z);
123BV_EXPORT extern void pl_3move(FILE *plotfp,
124 int x,
125 int y,
126 int z);
127BV_EXPORT extern void pl_3cont(FILE *plotfp,
128 int x,
129 int y,
130 int z);
131BV_EXPORT extern void pl_3line(FILE *plotfp,
132 int x_1,
133 int y_1,
134 int z_1,
135 int x_2,
136 int y_2,
137 int z_2);
138BV_EXPORT extern void pl_3box(FILE *plotfp,
139 int x_1,
140 int y_1,
141 int z_1,
142 int x_2,
143 int y_2,
144 int z_2);
145
146/* Double floating point versions */
147BV_EXPORT extern void pd_point(FILE *plotfp,
148 double x,
149 double y);
150BV_EXPORT extern void pd_line(FILE *plotfp,
151 double fx,
152 double fy,
153 double tx,
154 double ty);
155BV_EXPORT extern void pd_move(FILE *plotfp,
156 double x,
157 double y);
158BV_EXPORT extern void pd_cont(FILE *plotfp,
159 double x,
160 double y);
161BV_EXPORT extern void pd_space(FILE *plotfp,
162 double x_1,
163 double y_1,
164 double x_2,
165 double y_2);
166BV_EXPORT extern void pd_circle(FILE *plotfp,
167 double x,
168 double y,
169 double r);
170BV_EXPORT extern void pd_arc(FILE *plotfp,
171 double xc,
172 double yc,
173 double x_1,
174 double y_1,
175 double x_2,
176 double y_2);
177BV_EXPORT extern void pd_box(FILE *plotfp,
178 double x_1,
179 double y_1,
180 double x_2,
181 double y_2);
182
183/* Double 3-D both in vector and enumerated versions */
184#ifdef VMATH_H
185BV_EXPORT extern void pdv_3space(FILE *plotfp,
186 const vect_t min,
187 const vect_t max);
188BV_EXPORT extern void pdv_3point(FILE *plotfp,
189 const vect_t pt);
190BV_EXPORT extern void pdv_3move(FILE *plotfp,
191 const vect_t pt);
192BV_EXPORT extern void pdv_3cont(FILE *plotfp,
193 const vect_t pt);
194BV_EXPORT extern void pdv_3line(FILE *plotfp,
195 const vect_t a,
196 const vect_t b);
197BV_EXPORT extern void pdv_3box(FILE *plotfp,
198 const vect_t a,
199 const vect_t b);
200#endif /* VMATH_H */
201BV_EXPORT extern void pd_3space(FILE *plotfp,
202 double x_1,
203 double y_1,
204 double z_1,
205 double x_2,
206 double y_2,
207 double z_2);
208BV_EXPORT extern void pd_3point(FILE *plotfp,
209 double x,
210 double y,
211 double z);
212BV_EXPORT extern void pd_3move(FILE *plotfp,
213 double x,
214 double y,
215 double z);
216BV_EXPORT extern void pd_3cont(FILE *plotfp,
217 double x,
218 double y,
219 double z);
220BV_EXPORT extern void pd_3line(FILE *plotfp,
221 double x_1,
222 double y_1,
223 double z_1,
224 double x_2,
225 double y_2,
226 double z_2);
227BV_EXPORT extern void pd_3box(FILE *plotfp,
228 double x_1,
229 double y_1,
230 double z_1,
231 double x_2,
232 double y_2,
233 double z_2);
234BV_EXPORT extern void pdv_3ray(FILE *fp,
235 const point_t pt,
236 const vect_t dir,
237 double t);
238
239
240BV_EXPORT extern int plot3_invalid(FILE *fp, int mode);
241
242__END_DECLS
243
244#endif /* BV_PLOT3_H */
245
246/** @} */
247/*
248 * Local Variables:
249 * mode: C
250 * tab-width: 8
251 * indent-tabs-mode: t
252 * c-file-style: "stroustrup"
253 * End:
254 * ex: shiftwidth=4 tabstop=8
255 */
Header file for the BRL-CAD common definitions.
void pl_erase(FILE *plotfp)
void float float * fy
Definition: tig.h:283
void pd_3point(FILE *plotfp, double x, double y, double z)
void pl_3space(FILE *plotfp, int x_1, int y_1, int z_1, int x_2, int y_2, int z_2)
void pd_circle(FILE *plotfp, double x, double y, double r)
void pl_arc(FILE *plotfp, int xc, int yc, int x_1, int y_1, int x_2, int y_2)
void pl_3box(FILE *plotfp, int x_1, int y_1, int z_1, int x_2, int y_2, int z_2)
int plot3_invalid(FILE *fp, int mode)
void pl_point(FILE *plotfp, int x, int y)
void pd_3move(FILE *plotfp, double x, double y, double z)
void float float * y
Definition: tig.h:73
void pl_setOutputMode(int mode)
void pl_color_buc(FILE *plotfp, struct bu_color *c)
void pd_point(FILE *plotfp, double x, double y)
void pl_space(FILE *plotfp, int x_1, int y_1, int x_2, int y_2)
void float float float float * tx
Definition: tig.h:285
void pd_3box(FILE *plotfp, double x_1, double y_1, double z_1, double x_2, double y_2, double z_2)
void pl_cont(FILE *plotfp, int x, int y)
void int char * mode
Definition: tig.h:179
void pd_box(FILE *plotfp, double x_1, double y_1, double x_2, double y_2)
void pl_flush(FILE *plotfp)
void pl_3cont(FILE *plotfp, int x, int y, int z)
void int char int int double * min
Definition: tig.h:182
void pl_circle(FILE *plotfp, int x, int y, int r)
void float * fx
Definition: tig.h:282
void pl_move(FILE *plotfp, int x, int y)
void pl_3move(FILE *plotfp, int x, int y, int z)
void float float float float float * ty
Definition: tig.h:286
void pdv_3ray(FILE *fp, const point_t pt, const vect_t dir, double t)
void pl_linmod(FILE *plotfp, const char *s)
void pd_line(FILE *plotfp, double fx, double fy, double tx, double ty)
int pl_getOutputMode(void)
void pd_space(FILE *plotfp, double x_1, double y_1, double x_2, double y_2)
void pl_line(FILE *plotfp, int fx, int fy, int tx, int ty)
void float float float * z
Definition: tig.h:90
void pl_label(FILE *plotfp, const char *s)
void pd_3cont(FILE *plotfp, double x, double y, double z)
void int * c
Definition: tig.h:139
void pd_arc(FILE *plotfp, double xc, double yc, double x_1, double y_1, double x_2, double y_2)
void pd_3line(FILE *plotfp, double x_1, double y_1, double z_1, double x_2, double y_2, double z_2)
void pl_3point(FILE *plotfp, int x, int y, int z)
void pd_move(FILE *plotfp, double x, double y)
void pd_cont(FILE *plotfp, double x, double y)
void float * x
Definition: tig.h:72
void pl_3line(FILE *plotfp, int x_1, int y_1, int z_1, int x_2, int y_2, int z_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 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)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:345
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
Definition: color.h:54
fundamental vector, matrix, quaternion math macros