92 # if defined(PLOT3_DLL_EXPORTS) && defined(PLOT3_DLL_IMPORTS)
93 # error "Only PLOT3_DLL_EXPORTS or PLOT3_DLL_IMPORTS can be defined, not both."
94 # elif defined(PLOT3_DLL_EXPORTS)
95 # define PLOT3_EXPORT COMPILER_DLLEXPORT
96 # elif defined(PLOT3_DLL_IMPORTS)
97 # define PLOT3_EXPORT COMPILER_DLLIMPORT
104 #define PL_OUTPUT_MODE_BINARY 0
105 #define PL_OUTPUT_MODE_TEXT 1
107 #if !defined(PLOT_PREFIX_STR)
108 # define PLOT_PREFIX_STR plot3_
110 #define PL_CONCAT2(a, b) a ## b
111 #define PL_CONCAT(a, b) PL_CONCAT2(a,b)
112 #define PL_ADD_PREFIX(b) PL_CONCAT(PLOT_PREFIX_STR,b)
115 #define pd_3box PL_ADD_PREFIX(pd_3box)
116 #define pd_3cont PL_ADD_PREFIX(pd_3cont)
117 #define pd_3line PL_ADD_PREFIX(pd_3line)
118 #define pd_3move PL_ADD_PREFIX(pd_3move)
119 #define pd_3point PL_ADD_PREFIX(pd_3point)
120 #define pd_3space PL_ADD_PREFIX(pd_3space)
121 #define pd_arc PL_ADD_PREFIX(pd_arc)
122 #define pd_box PL_ADD_PREFIX(pd_box)
123 #define pd_circle PL_ADD_PREFIX(pd_circle)
124 #define pd_cont PL_ADD_PREFIX(pd_cont)
125 #define pd_line PL_ADD_PREFIX(pd_line)
126 #define pd_move PL_ADD_PREFIX(pd_move)
127 #define pd_point PL_ADD_PREFIX(pd_point)
128 #define pd_space PL_ADD_PREFIX(pd_space)
129 #define pdv_3box PL_ADD_PREFIX(pdv_3box)
130 #define pdv_3cont PL_ADD_PREFIX(pdv_3cont)
131 #define pdv_3line PL_ADD_PREFIX(pdv_3line)
132 #define pdv_3move PL_ADD_PREFIX(pdv_3move)
133 #define pdv_3point PL_ADD_PREFIX(pdv_3point)
134 #define pdv_3ray PL_ADD_PREFIX(pdv_3ray)
135 #define pdv_3space PL_ADD_PREFIX(pdv_3space)
136 #define pl_3box PL_ADD_PREFIX(pl_3box)
137 #define pl_3cont PL_ADD_PREFIX(pl_3cont)
138 #define pl_3line PL_ADD_PREFIX(pl_3line)
139 #define pl_3move PL_ADD_PREFIX(pl_3move)
140 #define pl_3point PL_ADD_PREFIX(pl_3point)
141 #define pl_3space PL_ADD_PREFIX(pl_3space)
142 #define pl_arc PL_ADD_PREFIX(pl_arc)
143 #define pl_box PL_ADD_PREFIX(pl_box)
144 #define pl_circle PL_ADD_PREFIX(pl_circle)
145 #define pl_color PL_ADD_PREFIX(pl_color)
146 #define pl_color_buc PL_ADD_PREFIX(pl_color_buc)
147 #define pl_cont PL_ADD_PREFIX(pl_cont)
148 #define pl_erase PL_ADD_PREFIX(pl_erase)
149 #define pl_flush PL_ADD_PREFIX(pl_flush)
150 #define pl_getOutputMode PL_ADD_PREFIX(pl_getOutputMode)
151 #define pl_label PL_ADD_PREFIX(pl_label)
152 #define pl_line PL_ADD_PREFIX(pl_line)
153 #define pl_linmod PL_ADD_PREFIX(pl_linmod)
154 #define pl_move PL_ADD_PREFIX(pl_move)
155 #define pl_point PL_ADD_PREFIX(pl_point)
156 #define pl_setOutputMode PL_ADD_PREFIX(pl_setOutputMode)
157 #define pl_space PL_ADD_PREFIX(pl_space)
158 #define plot3_invalid PL_ADD_PREFIX(plot3_invalid)
346 #if defined(PLOT3_IMPLEMENTATION)
353 #define putsi(a) putc(a, plotfp); putc((a>>8), plotfp)
357 pd_3(FILE *plotfp,
double x,
double y,
double z,
char c)
361 unsigned char out[3*8+1];
370 ret = fwrite(out, 1, 3*8+1, plotfp);
375 fprintf(plotfp,
"%c %g %g %g\n",
c,
x,
y,
z);
381 pdv_3(FILE *plotfp,
const fastf_t *pt,
char c)
384 unsigned char out[3*8+1];
390 ret = fwrite(out, 1, 3*8+1, plotfp);
395 fprintf(plotfp,
"%c %g %g %g\n",
c,
V3ARGS(pt));
401 common_pd(FILE *plotfp,
double x,
double y,
char c)
405 unsigned char out[2*8+1];
413 ret = fwrite(out, 1, 2*8+1, plotfp);
418 fprintf(plotfp,
"%c %g %g\n",
c,
x,
y);
424 pl_3(FILE *plotfp,
int x,
int y,
int z,
char c)
432 fprintf(plotfp,
"%c %d %d %d\n",
c,
x,
y,
z);
442 return pl_outputMode;
447 pl_outputMode =
mode;
462 fprintf(plotfp,
"p %d %d\n",
x,
y);
467 pl_line(FILE *plotfp,
int px1,
int py1,
int px2,
int py2)
476 fprintf(plotfp,
"l %d %d %d %d\n", px1, py1, px2, py2);
489 fprintf(plotfp,
"f %s\n", s);
501 fprintf(plotfp,
"m %d %d\n",
x,
y);
513 fprintf(plotfp,
"n %d %d\n",
x,
y);
518 pl_label(FILE *plotfp,
const char *s)
526 fprintf(plotfp,
"t %s\n", s);
531 pl_space(FILE *plotfp,
int px1,
int py1,
int px2,
int py2)
540 fprintf(plotfp,
"s %d %d %d %d\n", px1, py1, px2, py2);
550 fprintf(plotfp,
"e\n");
562 fprintf(plotfp,
"c %d %d %d\n",
x,
y, r);
567 pl_arc(FILE *plotfp,
int xc,
int yc,
int px1,
int py1,
int px2,
int py2)
578 fprintf(plotfp,
"a %d %d %d %d %d %d\n", xc, yc, px1, py1, px2, py2);
583 pl_box(FILE *plotfp,
int px1,
int py1,
int px2,
int py2)
599 pl_color(FILE *plotfp,
int r,
int g,
int b)
607 fprintf(plotfp,
"C %d %d %d\n", r, g, b);
627 fprintf(plotfp,
"F\n");
634 pl_3space(FILE *plotfp,
int px1,
int py1,
int pz1,
int px2,
int py2,
int pz2)
645 fprintf(plotfp,
"S %d %d %d %d %d %d\n", px1, py1, pz1, px2, py2, pz2);
652 pl_3(plotfp,
x,
y,
z,
'P');
658 pl_3(plotfp,
x,
y,
z,
'M');
664 pl_3(plotfp,
x,
y,
z,
'N');
668 pl_3line(FILE *plotfp,
int px1,
int py1,
int pz1,
int px2,
int py2,
int pz2)
679 fprintf(plotfp,
"L %d %d %d %d %d %d\n", px1, py1, pz1, px2, py2, pz2);
684 pl_3box(FILE *plotfp,
int px1,
int py1,
int pz1,
int px2,
int py2,
int pz2)
717 common_pd( plotfp,
x,
y,
'x');
721 pd_line(FILE *plotfp,
double px1,
double py1,
double px2,
double py2)
725 unsigned char out[4*8+1];
735 ret = fwrite(out, 1, 4*8+1, plotfp);
740 fprintf(plotfp,
"v %g %g %g %g\n", px1, py1, px2, py2);
747 pd_move(FILE *plotfp,
double x,
double y)
749 common_pd( plotfp,
x,
y,
'o');
753 pd_cont(FILE *plotfp,
double x,
double y)
755 common_pd( plotfp,
x,
y,
'q');
759 pd_space(FILE *plotfp,
double px1,
double py1,
double px2,
double py2)
763 unsigned char out[4*8+1];
773 ret = fwrite(out, 1, 4*8+1, plotfp);
778 fprintf(plotfp,
"w %g %g %g %g\n", px1, py1, px2, py2);
783 pd_circle(FILE *plotfp,
double x,
double y,
double r)
787 unsigned char out[3*8+1];
796 ret = fwrite(out, 1, 3*8+1, plotfp);
801 fprintf(plotfp,
"i %g %g %g\n",
x,
y, r);
806 pd_arc(FILE *plotfp,
double xc,
double yc,
double px1,
double py1,
double px2,
double py2)
810 unsigned char out[6*8+1];
822 ret = fwrite(out, 1, 6*8+1, plotfp);
827 fprintf(plotfp,
"r %g %g %g %g %g %g\n", xc, yc, px1, py1, px2, py2);
832 pd_box(FILE *plotfp,
double px1,
double py1,
double px2,
double py2)
847 unsigned char out[6*8+1];
854 ret = fwrite(out, 1, 6*8+1, plotfp);
864 pd_3space(FILE *plotfp,
double px1,
double py1,
double pz1,
double px2,
double py2,
double pz2)
868 unsigned char out[6*8+1];
880 ret = fwrite(out, 1, 6*8+1, plotfp);
885 fprintf(plotfp,
"W %g %g %g %g %g %g\n", px1, py1, pz1, px2, py2, pz2);
892 pdv_3(plotfp, pt,
'X');
898 pd_3(plotfp,
x,
y,
z,
'X');
904 pdv_3(plotfp, pt,
'O');
908 pd_3move(FILE *plotfp,
double x,
double y,
double z)
910 pd_3(plotfp,
x,
y,
z,
'O');
916 pdv_3(plotfp, pt,
'Q');
920 pd_3cont(FILE *plotfp,
double x,
double y,
double z)
922 pd_3(plotfp,
x,
y,
z,
'Q');
929 unsigned char out[6*8+1];
936 ret = fwrite(out, 1, 6*8+1, plotfp);
941 fprintf(plotfp,
"V %g %g %g %g %g %g\n",
V3ARGS(a),
V3ARGS(b));
946 pd_3line(FILE *plotfp,
double px1,
double py1,
double pz1,
double px2,
double py2,
double pz2)
950 unsigned char out[6*8+1];
962 ret = fwrite(out, 1, 6*8+1, plotfp);
967 fprintf(plotfp,
"V %g %g %g %g %g %g\n", px1, py1, pz1, px2, py2, pz2);
999 pd_3box(FILE *plotfp,
double px1,
double py1,
double pz1,
double px2,
double py2,
double pz2)
1044 read_short(FILE *fp,
int cnt,
int mode)
1047 for (
int i = 0; i < cnt * 2; i++) {
1048 if (getc(fp) == EOF)
1056 for (
int i = 0; i < cnt; i++) {
1057 ret = fscanf(fp,
"%lf", &val);
1068 read_ieee(FILE *fp,
int cnt,
int mode)
1072 for (
int i = 0; i < cnt; i++) {
1082 for (
int i = 0; i < cnt; i++) {
1083 ret = (size_t)fscanf(fp,
"%lf", &val);
1093 read_tstring(FILE *fp,
int mode)
1099 while (!feof(fp) && !str_done) {
1107 char carg[256] = {0};
1108 ret = fscanf(fp,
"%255s\n", &carg[0]);
1132 unsigned int tchar = 0;
1134 while (!feof(fp) && (
c=getc(fp)) != EOF) {
1135 if (c < 'A' || c >
'z') {
1142 for (i = 0; i < 3; i++) {
1143 if (getc(fp) == EOF)
1148 i = fscanf(fp,
"%u", &tchar);
1158 if (read_short(fp, 6,
mode))
1163 if (read_short(fp, 3,
mode))
1168 if (read_short(fp, 3,
mode))
1173 if (read_ieee(fp, 3,
mode))
1178 if (read_short(fp, 3,
mode))
1183 if (read_ieee(fp, 3,
mode))
1188 if (read_short(fp, 6,
mode))
1193 if (read_ieee(fp, 6,
mode))
1198 if (read_ieee(fp, 6,
mode))
1203 if (read_ieee(fp, 3,
mode))
1208 if (read_short(fp, 6,
mode))
1213 if (read_short(fp, 3,
mode))
1221 if (read_tstring(fp,
mode))
1226 if (read_ieee(fp, 3,
mode))
1231 if (read_short(fp, 4,
mode))
1236 if (read_short(fp, 2,
mode))
1241 if (read_short(fp, 2,
mode))
1246 if (read_ieee(fp, 2,
mode))
1251 if (read_short(fp, 2,
mode))
1256 if (read_ieee(fp, 2,
mode))
1261 if (read_ieee(fp, 6,
mode))
1266 if (read_short(fp, 4,
mode))
1271 if (read_tstring(fp,
mode))
1276 if (read_ieee(fp, 4,
mode))
1281 if (read_ieee(fp, 4,
mode))
1286 if (read_ieee(fp, 2,
mode))
Header file for the BRL-CAD common definitions.
int bu_color_to_rgb_ints(const struct bu_color *cp, int *r, int *g, int *b)
#define SIZEOF_NETWORK_DOUBLE
void bu_cv_htond(unsigned char *out, const unsigned char *in, size_t count)
void float float float float * tx
void int char int int double * min
void float float float float float * ty
void float float float * z
#define PL_OUTPUT_MODE_BINARY
#define PL_OUTPUT_MODE_TEXT
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
double fastf_t
fastest 64-bit (or larger) floating point type
#define VJOIN1(o, a, sb, b)
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
fundamental vector, matrix, quaternion math macros