BRL-CAD
Loading...
Searching...
No Matches
plot3.h
Go to the documentation of this file.
1/* P L O T 3 . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2026 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 * @brief A public-domain UNIX plot library, for 2-D and 3-D plotting in 16-bit
23 * VAX signed integer spaces, or 64-bit IEEE floating point.
24 *
25 * These routines generate "UNIX plot" output (with the addition of 3-D
26 * commands). They behave almost exactly like the regular libplot routines,
27 * except:
28 *
29 * -# These all take a stdio file pointer, and can thus be used to create
30 * multiple plot files simultaneously.
31 * -# There are 3-D versions of most commands.
32 * -# There are IEEE floating point versions of the commands.
33 * -# The names have been changed.
34 *
35 * The 3-D extensions are those of Doug Gwyn, from his System V extensions.
36 * Plot3 also incorporates routines from the BRL TIG-PACK (Terminal
37 * Independent Plotting Package), originally written in 1978 and 1979 for
38 * generating polylines, markers, axes, simple XY plots, vectors, and plotted
39 * symbols using the plot3 primitives.
40 *
41 * The built-in vector font support descends from the Terminal Independent
42 * Graphics Display Package by Mike Muuss, July 31, 1978. The vector font
43 * table was provided courtesy of Dr. Bruce Henrikson and Dr. Stephen Wolff,
44 * U.S. Army Ballistic Research Laboratory, Summer 1978, based on work for a
45 * remote Houston Instruments pen plotter package on the GE Tymeshare system.
46 * The basic font resides in a 10x10 unit square; callers scale and transform
47 * those stroke lists into plot coordinates.
48 *
49 * These are the ascii command letters allocated to various actions. Care has
50 * been taken to consistently match lowercase and uppercase letters.
51 *
52 * @code
53 2d 3d 2df 3df
54 space s S w W
55 move m M o O
56 cont n N q Q
57 point p P x X
58 line l L v V
59 circle c i
60 arc a r
61 linmod f
62 label t
63 erase e
64 color C
65 flush F
66
67 bd gh jk uyz
68 ABDEGHIJKRTUYZ
69
70 @endcode
71 *
72 * The calling sequence is the same as the original Bell Labs routines, with
73 * the exception of the pl_ prefix on the name.
74 *
75 * NOTE: from libbv's perspective, plot3.h is a stand-alone header that does
76 * not use any other library functionality. To use this header without libbv,
77 * define PLOT3_IMPLEMENTATION before including the plot3.h header.
78 * The PLOT_PREFIX_STR mechanism below also can be used to allow
79 * PLOT3_IMPLEMENTATION to be included multiple times without conflict. (TODO
80 * - check if we can use inline instead of static to achieve a similar
81 * result...)
82 *
83 * Of interest: the Plan 9 sources (recently MIT licensed) appear to be
84 * related to the original code that would have formed the conceptual basis for
85 * these routines:
86 *
87 * https://plan9.io/sources/plan9/sys/src/cmd/plot/libplot/
88 *
89 * Don't know if there would be any improvements that could be retrofitted onto
90 * this version, but might be worth looking. In particular, curious if the
91 * spline routine might be useful...
92 */
93/** @{ */
94/** @file plot3.h */
95
96#ifndef PLOT3_H
97#define PLOT3_H
98
99#include "common.h"
100
101#include "vmath.h"
102#include "bu/color.h"
103#include "bu/file.h"
104
105#ifndef PLOT3_EXPORT
106# if defined(PLOT3_DLL_EXPORTS) && defined(PLOT3_DLL_IMPORTS)
107# error "Only PLOT3_DLL_EXPORTS or PLOT3_DLL_IMPORTS can be defined, not both."
108# elif defined(PLOT3_DLL_EXPORTS)
109# define PLOT3_EXPORT COMPILER_DLLEXPORT
110# elif defined(PLOT3_DLL_IMPORTS)
111# define PLOT3_EXPORT COMPILER_DLLIMPORT
112# else
113# define PLOT3_EXPORT
114# endif
115#endif
116
118#define PL_OUTPUT_MODE_BINARY 0
119#define PL_OUTPUT_MODE_TEXT 1
121#if !defined(PLOT_PREFIX_STR)
122# define PLOT_PREFIX_STR plot3_
123#endif
124#define PL_CONCAT2(a, b) a ## b
125#define PL_CONCAT(a, b) PL_CONCAT2(a,b)
126#define PL_ADD_PREFIX(b) PL_CONCAT(PLOT_PREFIX_STR,b)
128/* All linked symbols */
129#define pd_3box PL_ADD_PREFIX(pd_3box)
130#define pd_3cont PL_ADD_PREFIX(pd_3cont)
131#define pd_3line PL_ADD_PREFIX(pd_3line)
132#define pd_3move PL_ADD_PREFIX(pd_3move)
133#define pd_3point PL_ADD_PREFIX(pd_3point)
134#define pd_3space PL_ADD_PREFIX(pd_3space)
135#define pd_arc PL_ADD_PREFIX(pd_arc)
136#define pd_box PL_ADD_PREFIX(pd_box)
137#define pd_circle PL_ADD_PREFIX(pd_circle)
138#define pd_cont PL_ADD_PREFIX(pd_cont)
139#define pd_line PL_ADD_PREFIX(pd_line)
140#define pd_move PL_ADD_PREFIX(pd_move)
141#define pd_point PL_ADD_PREFIX(pd_point)
142#define pd_space PL_ADD_PREFIX(pd_space)
143#define pdv_3box PL_ADD_PREFIX(pdv_3box)
144#define pdv_3cont PL_ADD_PREFIX(pdv_3cont)
145#define pdv_3line PL_ADD_PREFIX(pdv_3line)
146#define pdv_3move PL_ADD_PREFIX(pdv_3move)
147#define pdv_3point PL_ADD_PREFIX(pdv_3point)
148#define pdv_3ray PL_ADD_PREFIX(pdv_3ray)
149#define pdv_3space PL_ADD_PREFIX(pdv_3space)
150#define pl_3box PL_ADD_PREFIX(pl_3box)
151#define pl_3cont PL_ADD_PREFIX(pl_3cont)
152#define pl_3line PL_ADD_PREFIX(pl_3line)
153#define pl_3move PL_ADD_PREFIX(pl_3move)
154#define pl_3point PL_ADD_PREFIX(pl_3point)
155#define pl_3space PL_ADD_PREFIX(pl_3space)
156#define pl_arc PL_ADD_PREFIX(pl_arc)
157#define pl_box PL_ADD_PREFIX(pl_box)
158#define pl_circle PL_ADD_PREFIX(pl_circle)
159#define pl_color PL_ADD_PREFIX(pl_color)
160#define pl_color_buc PL_ADD_PREFIX(pl_color_buc)
161#define pl_cont PL_ADD_PREFIX(pl_cont)
162#define pl_erase PL_ADD_PREFIX(pl_erase)
163#define pl_flush PL_ADD_PREFIX(pl_flush)
164#define pl_getOutputMode PL_ADD_PREFIX(pl_getOutputMode)
165#define pl_label PL_ADD_PREFIX(pl_label)
166#define pl_line PL_ADD_PREFIX(pl_line)
167#define pl_linmod PL_ADD_PREFIX(pl_linmod)
168#define pl_move PL_ADD_PREFIX(pl_move)
169#define pl_point PL_ADD_PREFIX(pl_point)
170#define pl_setOutputMode PL_ADD_PREFIX(pl_setOutputMode)
171#define pl_space PL_ADD_PREFIX(pl_space)
172#define pl_list PL_ADD_PREFIX(pl_list)
173#define plot3_invalid PL_ADD_PREFIX(plot3_invalid)
174#define plot3_data_scale PL_ADD_PREFIX(plot3_data_scale)
175#define plot3_float_split PL_ADD_PREFIX(plot3_float_split)
176#define plot3_float_to_ascii PL_ADD_PREFIX(plot3_float_to_ascii)
177#define plot3_font_getchar PL_ADD_PREFIX(plot3_font_getchar)
178#define plot3_ipow PL_ADD_PREFIX(plot3_ipow)
179#define plot3_scale_fit PL_ADD_PREFIX(plot3_scale_fit)
180#define plot3_xy_plot PL_ADD_PREFIX(plot3_xy_plot)
181#define pd_3list PL_ADD_PREFIX(pd_3list)
182#define pd_3marker PL_ADD_PREFIX(pd_3marker)
183#define pd_list PL_ADD_PREFIX(pd_list)
184#define pd_marked_list PL_ADD_PREFIX(pd_marked_list)
185#define pd_marker PL_ADD_PREFIX(pd_marker)
186#define pd_symbol PL_ADD_PREFIX(pd_symbol)
187#define pdv_3axis PL_ADD_PREFIX(pdv_3axis)
188#define pdv_3symbol PL_ADD_PREFIX(pdv_3symbol)
189#define pdv_3vector PL_ADD_PREFIX(pdv_3vector)
191#define PLOT3_FONT_LAST -128
192#define PLOT3_FONT_NEGY -127
194PLOT3_EXPORT extern int pl_getOutputMode(void);
195PLOT3_EXPORT extern void pl_setOutputMode(int mode);
196PLOT3_EXPORT extern void pl_point(FILE *plotfp,
197 int x,
198 int y);
199PLOT3_EXPORT extern void pl_line(FILE *plotfp,
200 int fx,
201 int fy,
202 int tx,
203 int ty);
204PLOT3_EXPORT extern void pl_linmod(FILE *plotfp,
205 const char *s);
206PLOT3_EXPORT extern void pl_move(FILE *plotfp,
207 int x,
208 int y);
209PLOT3_EXPORT extern void pl_cont(FILE *plotfp,
210 int x,
211 int y);
212PLOT3_EXPORT extern void pl_label(FILE *plotfp,
213 const char *s);
214PLOT3_EXPORT extern void pl_space(FILE *plotfp,
215 int x_1,
216 int y_1,
217 int x_2,
218 int y_2);
219PLOT3_EXPORT extern void pl_erase(FILE *plotfp);
220PLOT3_EXPORT extern void pl_circle(FILE *plotfp,
221 int x,
222 int y,
223 int r);
224PLOT3_EXPORT extern void pl_arc(FILE *plotfp,
225 int xc,
226 int yc,
227 int x_1,
228 int y_1,
229 int x_2,
230 int y_2);
231PLOT3_EXPORT extern void pl_box(FILE *plotfp,
232 int x_1,
233 int y_1,
234 int x_2,
235 int y_2);
236
237/*
238 * BRL extensions to the UNIX-plot file format.
239 */
240PLOT3_EXPORT extern void pl_color(FILE *plotfp,
241 int r,
242 int g,
243 int b);
244PLOT3_EXPORT extern void pl_color_buc(FILE *plotfp,
245 struct bu_color *c);
246PLOT3_EXPORT extern void pl_flush(FILE *plotfp);
247PLOT3_EXPORT extern void pl_3space(FILE *plotfp,
248 int x_1,
249 int y_1,
250 int z_1,
251 int x_2,
252 int y_2,
253 int z_2);
254PLOT3_EXPORT extern void pl_3point(FILE *plotfp,
255 int x,
256 int y,
257 int z);
258PLOT3_EXPORT extern void pl_3move(FILE *plotfp,
259 int x,
260 int y,
261 int z);
262PLOT3_EXPORT extern void pl_3cont(FILE *plotfp,
263 int x,
264 int y,
265 int z);
266PLOT3_EXPORT extern void pl_3line(FILE *plotfp,
267 int x_1,
268 int y_1,
269 int z_1,
270 int x_2,
271 int y_2,
272 int z_2);
273PLOT3_EXPORT extern void pl_3box(FILE *plotfp,
274 int x_1,
275 int y_1,
276 int z_1,
277 int x_2,
278 int y_2,
279 int z_2);
280
281/* Double floating point versions */
282PLOT3_EXPORT extern void pd_point(FILE *plotfp,
283 double x,
284 double y);
285PLOT3_EXPORT extern void pd_line(FILE *plotfp,
286 double fx,
287 double fy,
288 double tx,
289 double ty);
290PLOT3_EXPORT extern void pd_move(FILE *plotfp,
291 double x,
292 double y);
293PLOT3_EXPORT extern void pd_cont(FILE *plotfp,
294 double x,
295 double y);
296PLOT3_EXPORT extern void pd_space(FILE *plotfp,
297 double x_1,
298 double y_1,
299 double x_2,
300 double y_2);
301PLOT3_EXPORT extern void pd_circle(FILE *plotfp,
302 double x,
303 double y,
304 double r);
305PLOT3_EXPORT extern void pd_arc(FILE *plotfp,
306 double xc,
307 double yc,
308 double x_1,
309 double y_1,
310 double x_2,
311 double y_2);
312PLOT3_EXPORT extern void pd_box(FILE *plotfp,
313 double x_1,
314 double y_1,
315 double x_2,
316 double y_2);
317
318/* Double 3-D both in vector and enumerated versions */
319#ifdef VMATH_H
320PLOT3_EXPORT extern void pdv_3space(FILE *plotfp,
321 const vect_t min,
322 const vect_t max);
323PLOT3_EXPORT extern void pdv_3point(FILE *plotfp,
324 const vect_t pt);
325PLOT3_EXPORT extern void pdv_3move(FILE *plotfp,
326 const vect_t pt);
327PLOT3_EXPORT extern void pdv_3cont(FILE *plotfp,
328 const vect_t pt);
329PLOT3_EXPORT extern void pdv_3line(FILE *plotfp,
330 const vect_t a,
331 const vect_t b);
332PLOT3_EXPORT extern void pdv_3box(FILE *plotfp,
333 const vect_t a,
334 const vect_t b);
335#endif /* VMATH_H */
336PLOT3_EXPORT extern void pd_3space(FILE *plotfp,
337 double x_1,
338 double y_1,
339 double z_1,
340 double x_2,
341 double y_2,
342 double z_2);
343PLOT3_EXPORT extern void pd_3point(FILE *plotfp,
344 double x,
345 double y,
346 double z);
347PLOT3_EXPORT extern void pd_3move(FILE *plotfp,
348 double x,
349 double y,
350 double z);
351PLOT3_EXPORT extern void pd_3cont(FILE *plotfp,
352 double x,
353 double y,
354 double z);
355PLOT3_EXPORT extern void pd_3line(FILE *plotfp,
356 double x_1,
357 double y_1,
358 double z_1,
359 double x_2,
360 double y_2,
361 double z_2);
362PLOT3_EXPORT extern void pd_3box(FILE *plotfp,
363 double x_1,
364 double y_1,
365 double z_1,
366 double x_2,
367 double y_2,
368 double z_2);
369PLOT3_EXPORT extern void pdv_3ray(FILE *fp,
370 const point_t pt,
371 const vect_t dir,
372 double t);
373
374PLOT3_EXPORT extern void pl_list(FILE *fp,
375 int *x,
376 int *y,
377 int npoints);
378PLOT3_EXPORT extern void pd_list(FILE *fp,
379 double *x,
380 double *y,
381 int npoints);
382PLOT3_EXPORT extern void pd_3list(FILE *fp,
383 double *x,
384 double *y,
385 double *z,
386 int npoints);
387PLOT3_EXPORT extern void pd_marked_list(FILE *fp,
388 double *x,
389 double *y,
390 int npoints,
391 int flag,
392 int mark,
393 int interval,
394 double size);
395PLOT3_EXPORT extern void pd_marker(FILE *fp,
396 int c,
397 double x,
398 double y,
399 double scale);
400PLOT3_EXPORT extern void pd_3marker(FILE *fp,
401 int c,
402 double x,
403 double y,
404 double z,
405 double scale);
406PLOT3_EXPORT extern void plot3_data_scale(int idata[],
408 int mode,
409 int length,
410 int odata[],
411 double *min,
412 double *dx);
413PLOT3_EXPORT extern void pd_symbol(FILE *fp,
414 char *string,
415 double x,
416 double y,
417 double scale,
418 double theta);
419PLOT3_EXPORT extern void plot3_xy_plot(FILE *fp,
420 int xp,
421 int yp,
422 int xl,
423 int yl,
424 char xtitle[],
425 char ytitle[],
426 float x[],
427 float y[],
428 int n,
429 double cscale);
430PLOT3_EXPORT extern void plot3_float_to_ascii(float x, char *s);
431PLOT3_EXPORT extern void plot3_scale_fit(float *x,
432 int npts,
433 float size,
434 float *xs,
435 float *xmin,
436 float *xmax,
437 float *dx);
438PLOT3_EXPORT extern void plot3_float_split(float x,
439 float *coef,
440 int *ex);
441PLOT3_EXPORT extern double plot3_ipow(double x,
442 int n);
443PLOT3_EXPORT extern void pdv_3axis(FILE *fp,
444 char *string,
445 point_t origin,
446 mat_t rot,
447 double length,
448 int ccw,
449 int ndigits,
450 double label_start,
451 double label_incr,
452 double tick_separation,
453 double char_width);
454PLOT3_EXPORT extern void pdv_3symbol(FILE *fp,
455 char *string,
456 point_t origin,
457 mat_t rot,
458 double scale);
459PLOT3_EXPORT extern void pdv_3vector(FILE *plotfp,
461 point_t to,
462 double fromheadfract,
463 double toheadfract);
464PLOT3_EXPORT extern int *plot3_font_getchar(const unsigned char *c);
466PLOT3_EXPORT extern int plot3_invalid(FILE *fp, int mode);
469
470#if defined(PLOT3_IMPLEMENTATION)
471#include <stdio.h>
472#include <math.h>
473#include <string.h>
474#include "bu/cv.h"
475
477
478/* For the sake of efficiency, we trust putc() to write only one byte */
479#define putsi(a) putc(a, plotfp); putc((a>>8), plotfp)
480
481/* Making a common pd_3 to be used in pd_3cont and pd_3move */
482static void
483pd_3(FILE *plotfp, double x, double y, double z, char c)
484{
485 size_t ret;
486 double in[3];
487 unsigned char out[3*8+1];
488
490 in[0] = x;
491 in[1] = y;
492 in[2] = z;
493 bu_cv_htond(&out[1], (unsigned char *)in, 3);
494
495 out[0] = c;
496 ret = fwrite(out, 1, 3*8+1, plotfp);
497 if (ret != 3*8+1) {
498 perror("fwrite");
499 }
500 } else {
501 fprintf(plotfp, "%c %g %g %g\n", c, x, y, z);
502 }
503}
504
505/* Making a common pdv_3 to be used in pdv_3cont and pdv_3move */
506static void
507pdv_3(FILE *plotfp, const fastf_t *pt, char c)
508{
509 size_t ret;
510 unsigned char out[3*8+1];
511
513 bu_cv_htond(&out[1], (unsigned char *)pt, 3);
514
515 out[0] = c;
516 ret = fwrite(out, 1, 3*8+1, plotfp);
517 if (ret != 3*8+1) {
518 perror("fwrite");
519 }
520 } else {
521 fprintf(plotfp, "%c %g %g %g\n", c, V3ARGS(pt));
522 }
523}
524
525/* Making a common pd to be used in pd_cont and pd_move */
526static void
527common_pd(FILE *plotfp, double x, double y, char c)
528{
529 size_t ret;
530 double in[2];
531 unsigned char out[2*8+1];
532
534 in[0] = x;
535 in[1] = y;
536 bu_cv_htond(&out[1], (unsigned char *)in, 2);
537
538 out[0] = c;
539 ret = fwrite(out, 1, 2*8+1, plotfp);
540 if (ret != 2*8+1) {
541 perror("fwrite");
542 }
543 } else {
544 fprintf(plotfp, "%c %g %g\n", c, x, y);
545 }
546}
547
548/* Making a common pl_3 to be used in pl_3cont and pl_3move */
549static void
550pl_3(FILE *plotfp, int x, int y, int z, char c)
551{
553 putc( c, plotfp);
554 putsi(x);
555 putsi(y);
556 putsi(z);
557 } else {
558 fprintf(plotfp, "%c %d %d %d\n", c, x, y, z);
559 }
560}
561
562/*
563 * These interfaces provide the standard UNIX-Plot functionality
564 */
565
566int
567pl_getOutputMode(void) {
568 return pl_outputMode;
569}
570
571void
572pl_setOutputMode(int mode) {
573 pl_outputMode = mode;
574}
575
576/**
577 * @brief
578 * plot a point
579 */
580void
581pl_point(FILE *plotfp, int x, int y)
582{
584 putc('p', plotfp);
585 putsi(x);
586 putsi(y);
587 } else {
588 fprintf(plotfp, "p %d %d\n", x, y);
589 }
590}
591
592void
593pl_line(FILE *plotfp, int px1, int py1, int px2, int py2)
594{
596 putc('l', plotfp);
597 putsi(px1);
598 putsi(py1);
599 putsi(px2);
600 putsi(py2);
601 } else {
602 fprintf(plotfp, "l %d %d %d %d\n", px1, py1, px2, py2);
603 }
604}
605
606void
607pl_linmod(FILE *plotfp, const char *s)
608{
610 putc('f', plotfp);
611 while (*s)
612 putc(*s++, plotfp);
613 putc('\n', plotfp);
614 } else {
615 fprintf(plotfp, "f %s\n", s);
616 }
617}
618
619void
620pl_move(FILE *plotfp, int x, int y)
621{
623 putc('m', plotfp);
624 putsi(x);
625 putsi(y);
626 } else {
627 fprintf(plotfp, "m %d %d\n", x, y);
628 }
629}
630
631void
632pl_cont(FILE *plotfp, int x, int y)
633{
635 putc('n', plotfp);
636 putsi(x);
637 putsi(y);
638 } else {
639 fprintf(plotfp, "n %d %d\n", x, y);
640 }
641}
642
643void
644pl_label(FILE *plotfp, const char *s)
645{
647 putc('t', plotfp);
648 while (*s)
649 putc(*s++, plotfp);
650 putc('\n', plotfp);
651 } else {
652 fprintf(plotfp, "t %s\n", s);
653 }
654}
655
656void
657pl_space(FILE *plotfp, int px1, int py1, int px2, int py2)
658{
660 putc('s', plotfp);
661 putsi(px1);
662 putsi(py1);
663 putsi(px2);
664 putsi(py2);
665 } else {
666 fprintf(plotfp, "s %d %d %d %d\n", px1, py1, px2, py2);
667 }
668}
669
670void
671pl_erase(FILE *plotfp)
672{
674 putc('e', plotfp);
675 else
676 fprintf(plotfp, "e\n");
677}
678
679void
680pl_circle(FILE *plotfp, int x, int y, int r)
681{
683 putc('c', plotfp);
684 putsi(x);
685 putsi(y);
686 putsi(r);
687 } else {
688 fprintf(plotfp, "c %d %d %d\n", x, y, r);
689 }
690}
691
692void
693pl_arc(FILE *plotfp, int xc, int yc, int px1, int py1, int px2, int py2)
694{
696 putc('a', plotfp);
697 putsi(xc);
698 putsi(yc);
699 putsi(px1);
700 putsi(py1);
701 putsi(px2);
702 putsi(py2);
703 } else {
704 fprintf(plotfp, "a %d %d %d %d %d %d\n", xc, yc, px1, py1, px2, py2);
705 }
706}
707
708void
709pl_box(FILE *plotfp, int px1, int py1, int px2, int py2)
710{
717}
718
719/*
720 * Here lie the BRL 3-D extensions.
721 */
722
723/* Warning: r, g, b are ints. The output is chars. */
724void
725pl_color(FILE *plotfp, int r, int g, int b)
726{
728 putc('C', plotfp);
729 putc(r, plotfp);
730 putc(g, plotfp);
731 putc(b, plotfp);
732 } else {
733 fprintf(plotfp, "C %d %d %d\n", r, g, b);
734 }
735}
736
737void
738pl_color_buc(FILE *plotfp, struct bu_color *c)
739{
740 int r = 0;
741 int g = 0;
742 int b = 0;
743 (void)bu_color_to_rgb_ints(c, &r, &g, &b);
744 pl_color(plotfp, r, g, b);
745}
746
747void
748pl_flush(FILE *plotfp)
749{
751 putc('F', plotfp);
752 } else {
753 fprintf(plotfp, "F\n");
754 }
755
756 fflush(plotfp);
757}
758
759void
760pl_3space(FILE *plotfp, int px1, int py1, int pz1, int px2, int py2, int pz2)
761{
763 putc('S', plotfp);
764 putsi(px1);
765 putsi(py1);
766 putsi(pz1);
767 putsi(px2);
768 putsi(py2);
769 putsi(pz2);
770 } else {
771 fprintf(plotfp, "S %d %d %d %d %d %d\n", px1, py1, pz1, px2, py2, pz2);
772 }
773}
774
775void
776pl_3point(FILE *plotfp, int x, int y, int z)
777{
778 pl_3(plotfp, x, y, z, 'P'); /* calling common function pl_3 */
779}
780
781void
782pl_3move(FILE *plotfp, int x, int y, int z)
783{
784 pl_3(plotfp, x, y, z, 'M'); /* calling common function pl_3 */
785}
786
787void
788pl_3cont(FILE *plotfp, int x, int y, int z)
789{
790 pl_3(plotfp, x, y, z, 'N'); /* calling common function pl_3 */
791}
792
793void
794pl_3line(FILE *plotfp, int px1, int py1, int pz1, int px2, int py2, int pz2)
795{
797 putc('L', plotfp);
798 putsi(px1);
799 putsi(py1);
800 putsi(pz1);
801 putsi(px2);
802 putsi(py2);
803 putsi(pz2);
804 } else {
805 fprintf(plotfp, "L %d %d %d %d %d %d\n", px1, py1, pz1, px2, py2, pz2);
806 }
807}
808
809void
810pl_3box(FILE *plotfp, int px1, int py1, int pz1, int px2, int py2, int pz2)
811{
813 /* first side */
818 /* across */
820 /* second side */
825 /* front edge */
828 /* bottom back */
831 /* top back */
834}
835
836/*
837 * Double floating point versions
838 */
839
840void
841pd_point(FILE *plotfp, double x, double y)
842{
843 common_pd( plotfp, x, y, 'x'); /* calling common function pd */
844}
845
846void
847pd_line(FILE *plotfp, double px1, double py1, double px2, double py2)
848{
849 size_t ret;
850 double in[4];
851 unsigned char out[4*8+1];
852
854 in[0] = px1;
855 in[1] = py1;
856 in[2] = px2;
857 in[3] = py2;
858 bu_cv_htond(&out[1], (unsigned char *)in, 4);
859
860 out[0] = 'v';
861 ret = fwrite(out, 1, 4*8+1, plotfp);
862 if (ret != 4*8+1) {
863 perror("fwrite");
864 }
865 } else {
866 fprintf(plotfp, "v %g %g %g %g\n", px1, py1, px2, py2);
867 }
868}
869
870/* Note: no pd_linmod(), just use pl_linmod() */
871
872void
873pd_move(FILE *plotfp, double x, double y)
874{
875 common_pd( plotfp, x, y, 'o'); /* calling common function pd */
876}
877
878void
879pd_cont(FILE *plotfp, double x, double y)
880{
881 common_pd( plotfp, x, y, 'q'); /* calling common function pd */
882}
883
884void
885pd_space(FILE *plotfp, double px1, double py1, double px2, double py2)
886{
887 size_t ret;
888 double in[4];
889 unsigned char out[4*8+1];
890
892 in[0] = px1;
893 in[1] = py1;
894 in[2] = px2;
895 in[3] = py2;
896 bu_cv_htond(&out[1], (unsigned char *)in, 4);
897
898 out[0] = 'w';
899 ret = fwrite(out, 1, 4*8+1, plotfp);
900 if (ret != 4*8+1) {
901 perror("fwrite");
902 }
903 } else {
904 fprintf(plotfp, "w %g %g %g %g\n", px1, py1, px2, py2);
905 }
906}
907
908void
909pd_circle(FILE *plotfp, double x, double y, double r)
910{
911 size_t ret;
912 double in[3];
913 unsigned char out[3*8+1];
914
916 in[0] = x;
917 in[1] = y;
918 in[2] = r;
919 bu_cv_htond(&out[1], (unsigned char *)in, 3);
920
921 out[0] = 'i';
922 ret = fwrite(out, 1, 3*8+1, plotfp);
923 if (ret != 3*8+1) {
924 perror("fwrite");
925 }
926 } else {
927 fprintf(plotfp, "i %g %g %g\n", x, y, r);
928 }
929}
930
931void
932pd_arc(FILE *plotfp, double xc, double yc, double px1, double py1, double px2, double py2)
933{
934 size_t ret;
935 double in[6];
936 unsigned char out[6*8+1];
937
939 in[0] = xc;
940 in[1] = yc;
941 in[2] = px1;
942 in[3] = py1;
943 in[4] = px2;
944 in[5] = py2;
945 bu_cv_htond(&out[1], (unsigned char *)in, 6);
946
947 out[0] = 'r';
948 ret = fwrite(out, 1, 6*8+1, plotfp);
949 if (ret != 6*8+1) {
950 perror("fwrite");
951 }
952 } else {
953 fprintf(plotfp, "r %g %g %g %g %g %g\n", xc, yc, px1, py1, px2, py2);
954 }
955}
956
957void
958pd_box(FILE *plotfp, double px1, double py1, double px2, double py2)
959{
966}
967
968/* Double 3-D, both in vector and enumerated versions */
969void
970pdv_3space(FILE *plotfp, const vect_t min, const vect_t max)
971{
972 size_t ret;
973 unsigned char out[6*8+1];
974
976 bu_cv_htond(&out[1], (unsigned char *)min, 3);
977 bu_cv_htond(&out[3*8+1], (unsigned char *)max, 3);
978
979 out[0] = 'W';
980 ret = fwrite(out, 1, 6*8+1, plotfp);
981 if (ret != 6*8+1) {
982 perror("fwrite");
983 }
984 } else {
985 fprintf(plotfp, "W %g %g %g %g %g %g\n", V3ARGS(min), V3ARGS(max));
986 }
987}
988
989void
990pd_3space(FILE *plotfp, double px1, double py1, double pz1, double px2, double py2, double pz2)
991{
992 size_t ret;
993 double in[6];
994 unsigned char out[6*8+1];
995
997 in[0] = px1;
998 in[1] = py1;
999 in[2] = pz1;
1000 in[3] = px2;
1001 in[4] = py2;
1002 in[5] = pz2;
1003 bu_cv_htond(&out[1], (unsigned char *)in, 6);
1004
1005 out[0] = 'W';
1006 ret = fwrite(out, 1, 6*8+1, plotfp);
1007 if (ret != 6*8+1) {
1008 perror("fwrite");
1009 }
1010 } else {
1011 fprintf(plotfp, "W %g %g %g %g %g %g\n", px1, py1, pz1, px2, py2, pz2);
1012 }
1013}
1014
1015void
1016pdv_3point(FILE *plotfp, const point_t pt)
1017{
1018 pdv_3(plotfp, pt, 'X'); /* calling common function pdv_3 */
1019}
1020
1021void
1022pd_3point(FILE *plotfp, double x, double y, double z)
1023{
1024 pd_3(plotfp, x, y, z, 'X'); /* calling common function pd_3 */
1025}
1026
1027void
1028pdv_3move(FILE *plotfp, const point_t pt)
1029{
1030 pdv_3(plotfp, pt, 'O'); /* calling common function pdv_3 */
1031}
1032
1033void
1034pd_3move(FILE *plotfp, double x, double y, double z)
1035{
1036 pd_3(plotfp, x, y, z, 'O'); /* calling common function pd_3 */
1037}
1038
1039void
1040pdv_3cont(FILE *plotfp, const point_t pt)
1041{
1042 pdv_3(plotfp, pt, 'Q'); /* calling common function pdv_3 */
1043}
1044
1045void
1046pd_3cont(FILE *plotfp, double x, double y, double z)
1047{
1048 pd_3(plotfp, x, y, z, 'Q'); /* calling common function pd_3 */
1049}
1050
1051void
1052pdv_3line(FILE *plotfp, const vect_t a, const vect_t b)
1053{
1054 size_t ret;
1055 unsigned char out[6*8+1];
1056
1058 bu_cv_htond(&out[1], (unsigned char *)a, 3);
1059 bu_cv_htond(&out[3*8+1], (unsigned char *)b, 3);
1060
1061 out[0] = 'V';
1062 ret = fwrite(out, 1, 6*8+1, plotfp);
1063 if (ret != 6*8+1) {
1064 perror("fwrite");
1065 }
1066 } else {
1067 fprintf(plotfp, "V %g %g %g %g %g %g\n", V3ARGS(a), V3ARGS(b));
1068 }
1069}
1070
1071void
1072pd_3line(FILE *plotfp, double px1, double py1, double pz1, double px2, double py2, double pz2)
1073{
1074 size_t ret;
1075 double in[6];
1076 unsigned char out[6*8+1];
1077
1079 in[0] = px1;
1080 in[1] = py1;
1081 in[2] = pz1;
1082 in[3] = px2;
1083 in[4] = py2;
1084 in[5] = pz2;
1085 bu_cv_htond(&out[1], (unsigned char *)in, 6);
1086
1087 out[0] = 'V';
1088 ret = fwrite(out, 1, 6*8+1, plotfp);
1089 if (ret != 6*8+1) {
1090 perror("fwrite");
1091 }
1092 } else {
1093 fprintf(plotfp, "V %g %g %g %g %g %g\n", px1, py1, pz1, px2, py2, pz2);
1094 }
1095}
1096
1097void
1098pdv_3box(FILE *plotfp, const vect_t a, const vect_t b)
1099{
1100 pd_3move(plotfp, a[X], a[Y], a[Z]);
1101 /* first side */
1102 pd_3cont(plotfp, a[X], b[Y], a[Z]);
1103 pd_3cont(plotfp, a[X], b[Y], b[Z]);
1104 pd_3cont(plotfp, a[X], a[Y], b[Z]);
1105 pd_3cont(plotfp, a[X], a[Y], a[Z]);
1106 /* across */
1107 pd_3cont(plotfp, b[X], a[Y], a[Z]);
1108 /* second side */
1109 pd_3cont(plotfp, b[X], b[Y], a[Z]);
1110 pd_3cont(plotfp, b[X], b[Y], b[Z]);
1111 pd_3cont(plotfp, b[X], a[Y], b[Z]);
1112 pd_3cont(plotfp, b[X], a[Y], a[Z]);
1113 /* front edge */
1114 pd_3move(plotfp, a[X], b[Y], a[Z]);
1115 pd_3cont(plotfp, b[X], b[Y], a[Z]);
1116 /* bottom back */
1117 pd_3move(plotfp, a[X], a[Y], b[Z]);
1118 pd_3cont(plotfp, b[X], a[Y], b[Z]);
1119 /* top back */
1120 pd_3move(plotfp, a[X], b[Y], b[Z]);
1121 pd_3cont(plotfp, b[X], b[Y], b[Z]);
1122}
1123
1124void
1125pd_3box(FILE *plotfp, double px1, double py1, double pz1, double px2, double py2, double pz2)
1126{
1128 /* first side */
1133 /* across */
1135 /* second side */
1140 /* front edge */
1143 /* bottom back */
1146 /* top back */
1149}
1150
1151/**
1152 * Draw a ray
1153 */
1154void
1155pdv_3ray(FILE *fp, const point_t pt, const vect_t dir, double t)
1156{
1157 point_t tip;
1158
1159 VJOIN1(tip, pt, t, dir);
1160 pdv_3move(fp, pt);
1161 pdv_3cont(fp, tip);
1162}
1163
1164
1165/*
1166 * Routines to validate a plot file
1167 */
1168
1169static int
1170read_short(FILE *fp, int cnt, int mode)
1171{
1172 if (mode == PL_OUTPUT_MODE_BINARY) {
1173 for (int i = 0; i < cnt * 2; i++) {
1174 if (getc(fp) == EOF)
1175 return 1;
1176 }
1177 return 0;
1178 }
1179 if (mode == PL_OUTPUT_MODE_TEXT) {
1180 int ret;
1181 double val;
1182 for (int i = 0; i < cnt; i++) {
1183 ret = fscanf(fp, "%lf", &val);
1184 if (ret != 1)
1185 return 1;
1186 }
1187 return 0;
1188 }
1189
1190 return 1;
1191}
1192
1193static int
1194read_ieee(FILE *fp, int cnt, int mode)
1195{
1196 size_t ret;
1197 if (mode == PL_OUTPUT_MODE_BINARY) {
1198 for (int i = 0; i < cnt; i++) {
1201 if (ret != 1)
1202 return 1;
1203 }
1204 return 0;
1205 }
1206 if (mode == PL_OUTPUT_MODE_TEXT) {
1207 double val;
1208 for (int i = 0; i < cnt; i++) {
1209 ret = (size_t)fscanf(fp, "%lf", &val);
1210 if (ret != 1)
1211 return 1;
1212 }
1213 return 0;
1214 }
1215 return 1;
1216}
1217
1218static int
1219read_tstring(FILE *fp, int mode)
1220{
1221 int ret;
1222 if (mode == PL_OUTPUT_MODE_BINARY) {
1223 int str_done = 0;
1224 int cc;
1225 while (!feof(fp) && !str_done) {
1226 cc = getc(fp);
1227 if (cc == '\n')
1228 str_done = 1;
1229 }
1230 return 0;
1231 }
1232 if (mode == PL_OUTPUT_MODE_TEXT) {
1233 char carg[256] = {0};
1234 ret = fscanf(fp, "%255s\n", &carg[0]);
1235 if (ret != 1)
1236 return 1;
1237 return 0;
1238 }
1239 return 1;
1240}
1241
1242#define PLOT3_MARK 1
1243#define PLOT3_LINE 2
1244#define PLOT3_NUM_SYMBOLS 8
1245#define PLOT3_BRT(_x, _y) (11*(_x)+(_y))
1246#define PLOT3_DRK(_x, _y) -(11*(_x)+(_y))
1247#define PLOT3_BNEG(_x, _y) PLOT3_FONT_NEGY, PLOT3_BRT((_x), (_y))
1248#define PLOT3_DNEG(_x, _y) PLOT3_FONT_NEGY, PLOT3_DRK((_x), (_y))
1249#define PLOT3_TICK_YLEN (char_width)
1250#define PLOT3_NUM_YOFF (3*char_width)
1251#define PLOT3_TITLE_YOFF (5*char_width)
1252#define PLOT3_TIC 100
1253#define PLOT3_REF_WIDTH 0.857143
1254#define PLOT3_NUM_DISTANCE 250
1255#define PLOT3_LAB_LNGTH 860
1256
1257static int *plot3_font_index[256];
1258
1259static int plot3_font_table[] = {
1260
1261/* + */
1262 PLOT3_DRK(0, 5),
1263 PLOT3_BRT(8, 5),
1264 PLOT3_DRK(4, 8),
1265 PLOT3_BRT(4, 2),
1267
1268/* x */
1269 PLOT3_DRK(0, 2),
1270 PLOT3_BRT(8, 8),
1271 PLOT3_DRK(0, 8),
1272 PLOT3_BRT(8, 2),
1274
1275/* triangle */
1276 PLOT3_DRK(0, 2),
1277 PLOT3_BRT(4, 8),
1278 PLOT3_BRT(8, 2),
1279 PLOT3_BRT(0, 2),
1281
1282/* square */
1283 PLOT3_DRK(0, 2),
1284 PLOT3_BRT(0, 8),
1285 PLOT3_BRT(8, 8),
1286 PLOT3_BRT(8, 2),
1287 PLOT3_BRT(0, 2),
1289
1290/* hourglass */
1291 PLOT3_DRK(0, 2),
1292 PLOT3_BRT(8, 8),
1293 PLOT3_BRT(0, 8),
1294 PLOT3_BRT(8, 2),
1295 PLOT3_BRT(0, 2),
1297
1298/* plus-minus */
1299 PLOT3_DRK(5, 7),
1300 PLOT3_BRT(5, 2),
1301 PLOT3_DRK(2, 2),
1302 PLOT3_BRT(8, 2),
1303 PLOT3_DRK(2, 5),
1304 PLOT3_BRT(8, 5),
1306
1307/* centerline symbol */
1308 PLOT3_DRK(8, 4),
1309 PLOT3_BRT(7, 6),
1310 PLOT3_BRT(4, 7),
1311 PLOT3_BRT(1, 6),
1312 PLOT3_BRT(0, 4),
1313 PLOT3_BRT(1, 2),
1314 PLOT3_BRT(4, 1),
1315 PLOT3_BRT(7, 2),
1316 PLOT3_BRT(8, 4),
1317 PLOT3_DRK(1, 1),
1318 PLOT3_BRT(7, 7),
1320
1321/* degree symbol */
1322 PLOT3_DRK(1, 9),
1323 PLOT3_BRT(2, 9),
1324 PLOT3_BRT(3, 8),
1325 PLOT3_BRT(3, 7),
1326 PLOT3_BRT(2, 6),
1327 PLOT3_BRT(1, 6),
1328 PLOT3_BRT(0, 7),
1329 PLOT3_BRT(0, 8),
1330 PLOT3_BRT(1, 9),
1332
1333/* table for ascii 040, ' ' */
1335
1336/* table for ! */
1337 PLOT3_DRK(3, 0),
1338 PLOT3_BRT(5, 2),
1339 PLOT3_BRT(5, 0),
1340 PLOT3_BRT(3, 2),
1341 PLOT3_BRT(3, 0),
1342 PLOT3_DRK(4, 4),
1343 PLOT3_BRT(3, 10),
1344 PLOT3_BRT(5, 10),
1345 PLOT3_BRT(4, 4),
1346 PLOT3_BRT(4, 10),
1348
1349/* table for " */
1350 PLOT3_DRK(1, 10),
1351 PLOT3_BRT(3, 10),
1352 PLOT3_BRT(2, 7),
1353 PLOT3_BRT(1, 10),
1354 PLOT3_DRK(5, 10),
1355 PLOT3_BRT(7, 10),
1356 PLOT3_BRT(6, 7),
1357 PLOT3_BRT(5, 10),
1359
1360
1361/* table for # */
1362 PLOT3_DRK(1, 0),
1363 PLOT3_BRT(3, 9),
1364 PLOT3_DRK(6, 9),
1365 PLOT3_BRT(4, 0),
1366 PLOT3_DRK(6, 3),
1367 PLOT3_BRT(0, 3),
1368 PLOT3_DRK(1, 6),
1369 PLOT3_BRT(7, 6),
1371
1372/* table for $ */
1373 PLOT3_DRK(1, 2),
1374 PLOT3_BRT(1, 1),
1375 PLOT3_BRT(7, 1),
1376 PLOT3_BRT(7, 5),
1377 PLOT3_BRT(1, 5),
1378 PLOT3_BRT(1, 9),
1379 PLOT3_BRT(7, 9),
1380 PLOT3_BRT(7, 8),
1381 PLOT3_DRK(4, 10),
1382 PLOT3_BRT(4, 0),
1384
1385/* table for % */
1386 PLOT3_DRK(3, 10),
1387 PLOT3_BRT(3, 7),
1388 PLOT3_BRT(0, 7),
1389 PLOT3_BRT(0, 10),
1390 PLOT3_BRT(8, 10),
1391 PLOT3_BRT(0, 0),
1392 PLOT3_DRK(8, 0),
1393 PLOT3_BRT(5, 0),
1394 PLOT3_BRT(5, 3),
1395 PLOT3_BRT(8, 3),
1396 PLOT3_BRT(8, 0),
1398
1399/* table for & */
1400 PLOT3_DRK(7, 3),
1401 PLOT3_BRT(4, 0),
1402 PLOT3_BRT(1, 0),
1403 PLOT3_BRT(0, 3),
1404 PLOT3_BRT(5, 8),
1405 PLOT3_BRT(4, 10),
1406 PLOT3_BRT(3, 10),
1407 PLOT3_BRT(1, 8),
1408 PLOT3_BRT(8, 0),
1410
1411/* table for ' */
1412 PLOT3_DRK(4, 6),
1413 PLOT3_BRT(5, 10),
1414 PLOT3_BRT(6, 10),
1415 PLOT3_BRT(4, 6),
1417
1418/* table for ( */
1419 PLOT3_DRK(5, 0),
1420 PLOT3_BRT(3, 1),
1421 PLOT3_BRT(2, 4),
1422 PLOT3_BRT(2, 6),
1423 PLOT3_BRT(3, 9),
1424 PLOT3_BRT(5, 10),
1426
1427/* table for) */
1428 PLOT3_DRK(3, 0),
1429 PLOT3_BRT(5, 1),
1430 PLOT3_BRT(6, 4),
1431 PLOT3_BRT(6, 6),
1432 PLOT3_BRT(5, 9),
1433 PLOT3_BRT(3, 10),
1435
1436/* table for * */
1437 PLOT3_DRK(4, 2),
1438 PLOT3_BRT(4, 8),
1439 PLOT3_DRK(6, 7),
1440 PLOT3_BRT(2, 3),
1441 PLOT3_DRK(6, 3),
1442 PLOT3_BRT(2, 7),
1443 PLOT3_DRK(1, 5),
1444 PLOT3_BRT(7, 5),
1446
1447/* table for + */
1448 PLOT3_DRK(1, 5),
1449 PLOT3_BRT(7, 5),
1450 PLOT3_DRK(4, 8),
1451 PLOT3_BRT(4, 2),
1453
1454/* table for, */
1455 PLOT3_DRK(5, 0),
1456 PLOT3_BRT(3, 2),
1457 PLOT3_BRT(3, 0),
1458 PLOT3_BRT(5, 2),
1459 PLOT3_BRT(5, 0),
1460 PLOT3_BNEG(2, 2),
1461 PLOT3_BRT(4, 0),
1463
1464/* table for - */
1465 PLOT3_DRK(1, 5),
1466 PLOT3_BRT(7, 5),
1468
1469/* table for . */
1470 PLOT3_DRK(5, 0),
1471 PLOT3_BRT(3, 2),
1472 PLOT3_BRT(3, 0),
1473 PLOT3_BRT(5, 2),
1474 PLOT3_BRT(5, 0),
1476
1477/* table for / */
1478 PLOT3_BRT(8, 10),
1480
1481/* table for 0 */
1482 PLOT3_DRK(8, 10),
1483 PLOT3_BRT(0, 0),
1484 PLOT3_BRT(0, 10),
1485 PLOT3_BRT(8, 10),
1486 PLOT3_BRT(8, 0),
1487 PLOT3_BRT(0, 0),
1489
1490/* table for 1 */
1491 PLOT3_DRK(4, 0),
1492 PLOT3_BRT(4, 10),
1493 PLOT3_BRT(2, 8),
1495
1496/* table for 2 */
1497 PLOT3_DRK(0, 6),
1498 PLOT3_BRT(0, 8),
1499 PLOT3_BRT(3, 10),
1500 PLOT3_BRT(5, 10),
1501 PLOT3_BRT(8, 8),
1502 PLOT3_BRT(8, 7),
1503 PLOT3_BRT(0, 2),
1504 PLOT3_BRT(0, 0),
1505 PLOT3_BRT(8, 0),
1507
1508/* table for 3 */
1509 PLOT3_DRK(0, 10),
1510 PLOT3_BRT(8, 10),
1511 PLOT3_BRT(8, 5),
1512 PLOT3_BRT(0, 5),
1513 PLOT3_BRT(8, 5),
1514 PLOT3_BRT(8, 0),
1515 PLOT3_BRT(0, 0),
1517
1518/* table for 4 */
1519 PLOT3_DRK(0, 10),
1520 PLOT3_BRT(0, 5),
1521 PLOT3_BRT(8, 5),
1522 PLOT3_DRK(8, 10),
1523 PLOT3_BRT(8, 0),
1525
1526/* table for 5 */
1527 PLOT3_DRK(8, 10),
1528 PLOT3_BRT(0, 10),
1529 PLOT3_BRT(0, 5),
1530 PLOT3_BRT(8, 5),
1531 PLOT3_BRT(8, 0),
1532 PLOT3_BRT(0, 0),
1534
1535/* table for 6 */
1536 PLOT3_DRK(0, 10),
1537 PLOT3_BRT(0, 0),
1538 PLOT3_BRT(8, 0),
1539 PLOT3_BRT(8, 5),
1540 PLOT3_BRT(0, 5),
1542
1543/* table for 7 */
1544 PLOT3_DRK(0, 10),
1545 PLOT3_BRT(8, 10),
1546 PLOT3_BRT(6, 0),
1548
1549/* table for 8 */
1550 PLOT3_DRK(0, 5),
1551 PLOT3_BRT(0, 0),
1552 PLOT3_BRT(8, 0),
1553 PLOT3_BRT(8, 5),
1554 PLOT3_BRT(0, 5),
1555 PLOT3_BRT(0, 10),
1556 PLOT3_BRT(8, 10),
1557 PLOT3_BRT(8, 5),
1559
1560/* table for 9 */
1561 PLOT3_DRK(8, 5),
1562 PLOT3_BRT(0, 5),
1563 PLOT3_BRT(0, 10),
1564 PLOT3_BRT(8, 10),
1565 PLOT3_BRT(8, 0),
1567
1568/* table for : */
1569 PLOT3_DRK(5, 6),
1570 PLOT3_BRT(3, 8),
1571 PLOT3_BRT(3, 6),
1572 PLOT3_BRT(5, 8),
1573 PLOT3_BRT(5, 6),
1574 PLOT3_DRK(5, 0),
1575 PLOT3_BRT(3, 2),
1576 PLOT3_BRT(3, 0),
1577 PLOT3_BRT(5, 2),
1578 PLOT3_BRT(5, 0),
1580
1581/* table for ; */
1582 PLOT3_DRK(5, 6),
1583 PLOT3_BRT(3, 8),
1584 PLOT3_BRT(3, 6),
1585 PLOT3_BRT(5, 8),
1586 PLOT3_BRT(5, 6),
1587 PLOT3_DRK(5, 0),
1588 PLOT3_BRT(3, 2),
1589 PLOT3_BRT(3, 0),
1590 PLOT3_BRT(5, 2),
1591 PLOT3_BRT(5, 0),
1592 PLOT3_BNEG(2, 2),
1593 PLOT3_BRT(4, 0),
1595
1596/* table for < */
1597 PLOT3_DRK(8, 8),
1598 PLOT3_BRT(0, 5),
1599 PLOT3_BRT(8, 2),
1601
1602/* table for = */
1603 PLOT3_DRK(0, 7),
1604 PLOT3_BRT(8, 7),
1605 PLOT3_DRK(0, 3),
1606 PLOT3_BRT(8, 3),
1608
1609/* table for > */
1610 PLOT3_DRK(0, 8),
1611 PLOT3_BRT(8, 5),
1612 PLOT3_BRT(0, 2),
1614
1615/* table for ? */
1616 PLOT3_DRK(3, 0),
1617 PLOT3_BRT(5, 2),
1618 PLOT3_BRT(5, 0),
1619 PLOT3_BRT(3, 2),
1620 PLOT3_BRT(3, 0),
1621 PLOT3_DRK(1, 7),
1622 PLOT3_BRT(1, 9),
1623 PLOT3_BRT(3, 10),
1624 PLOT3_BRT(5, 10),
1625 PLOT3_BRT(7, 9),
1626 PLOT3_BRT(7, 7),
1627 PLOT3_BRT(4, 5),
1628 PLOT3_BRT(4, 3),
1630
1631/* table for @ */
1632 PLOT3_DRK(0, 8),
1633 PLOT3_BRT(2, 10),
1634 PLOT3_BRT(6, 10),
1635 PLOT3_BRT(8, 8),
1636 PLOT3_BRT(8, 2),
1637 PLOT3_BRT(6, 0),
1638 PLOT3_BRT(2, 0),
1639 PLOT3_BRT(1, 1),
1640 PLOT3_BRT(1, 4),
1641 PLOT3_BRT(2, 5),
1642 PLOT3_BRT(4, 5),
1643 PLOT3_BRT(5, 4),
1644 PLOT3_BRT(5, 0),
1646
1647/* table for A */
1648 PLOT3_BRT(0, 8),
1649 PLOT3_BRT(2, 10),
1650 PLOT3_BRT(6, 10),
1651 PLOT3_BRT(8, 8),
1652 PLOT3_BRT(8, 0),
1653 PLOT3_DRK(0, 5),
1654 PLOT3_BRT(8, 5),
1656
1657/* table for B */
1658 PLOT3_BRT(0, 10),
1659 PLOT3_BRT(5, 10),
1660 PLOT3_BRT(8, 9),
1661 PLOT3_BRT(8, 6),
1662 PLOT3_BRT(5, 5),
1663 PLOT3_BRT(0, 5),
1664 PLOT3_BRT(5, 5),
1665 PLOT3_BRT(8, 4),
1666 PLOT3_BRT(8, 1),
1667 PLOT3_BRT(5, 0),
1668 PLOT3_BRT(0, 0),
1670
1671/* table for C */
1672 PLOT3_DRK(8, 2),
1673 PLOT3_BRT(6, 0),
1674 PLOT3_BRT(2, 0),
1675 PLOT3_BRT(0, 2),
1676 PLOT3_BRT(0, 8),
1677 PLOT3_BRT(2, 10),
1678 PLOT3_BRT(6, 10),
1679 PLOT3_BRT(8, 8),
1681
1682/* table for D */
1683 PLOT3_BRT(0, 10),
1684 PLOT3_BRT(5, 10),
1685 PLOT3_BRT(8, 8),
1686 PLOT3_BRT(8, 2),
1687 PLOT3_BRT(5, 0),
1688 PLOT3_BRT(0, 0),
1690
1691/* table for E */
1692 PLOT3_DRK(8, 0),
1693 PLOT3_BRT(0, 0),
1694 PLOT3_BRT(0, 10),
1695 PLOT3_BRT(8, 10),
1696 PLOT3_DRK(0, 5),
1697 PLOT3_BRT(5, 5),
1699
1700/* table for F */
1701 PLOT3_BRT(0, 10),
1702 PLOT3_BRT(8, 10),
1703 PLOT3_DRK(0, 5),
1704 PLOT3_BRT(5, 5),
1706
1707/* table for G */
1708 PLOT3_DRK(5, 5),
1709 PLOT3_BRT(8, 5),
1710 PLOT3_BRT(8, 2),
1711 PLOT3_BRT(6, 0),
1712 PLOT3_BRT(2, 0),
1713 PLOT3_BRT(0, 2),
1714 PLOT3_BRT(0, 8),
1715 PLOT3_BRT(2, 10),
1716 PLOT3_BRT(6, 10),
1717 PLOT3_BRT(8, 8),
1719
1720/* table for H */
1721 PLOT3_BRT(0, 10),
1722 PLOT3_DRK(8, 10),
1723 PLOT3_BRT(8, 0),
1724 PLOT3_DRK(0, 6),
1725 PLOT3_BRT(8, 6),
1727
1728/* table for I */
1729 PLOT3_DRK(4, 0),
1730 PLOT3_BRT(6, 0),
1731 PLOT3_DRK(5, 0),
1732 PLOT3_BRT(5, 10),
1733 PLOT3_BRT(4, 10),
1734 PLOT3_BRT(6, 10),
1736
1737/* table for J */
1738 PLOT3_DRK(0, 2),
1739 PLOT3_BRT(2, 0),
1740 PLOT3_BRT(5, 0),
1741 PLOT3_BRT(7, 2),
1742 PLOT3_BRT(7, 10),
1743 PLOT3_BRT(6, 10),
1744 PLOT3_BRT(8, 10),
1746
1747/* table for K */
1748 PLOT3_BRT(0, 10),
1749 PLOT3_DRK(0, 5),
1750 PLOT3_BRT(8, 10),
1751 PLOT3_DRK(3, 7),
1752 PLOT3_BRT(8, 0),
1754
1755/* table for L */
1756 PLOT3_DRK(8, 0),
1757 PLOT3_BRT(0, 0),
1758 PLOT3_BRT(0, 10),
1760
1761/* table for M */
1762 PLOT3_BRT(0, 10),
1763 PLOT3_BRT(4, 5),
1764 PLOT3_BRT(8, 10),
1765 PLOT3_BRT(8, 10),
1766 PLOT3_BRT(8, 0),
1768
1769/* table for N */
1770 PLOT3_BRT(0, 10),
1771 PLOT3_BRT(8, 0),
1772 PLOT3_BRT(8, 10),
1774
1775/* table for O */
1776 PLOT3_DRK(0, 2),
1777 PLOT3_BRT(0, 8),
1778 PLOT3_BRT(2, 10),
1779 PLOT3_BRT(6, 10),
1780 PLOT3_BRT(8, 8),
1781 PLOT3_BRT(8, 2),
1782 PLOT3_BRT(6, 0),
1783 PLOT3_BRT(2, 0),
1784 PLOT3_BRT(0, 2),
1786
1787/* table for P */
1788 PLOT3_BRT(0, 10),
1789 PLOT3_BRT(6, 10),
1790 PLOT3_BRT(8, 9),
1791 PLOT3_BRT(8, 6),
1792 PLOT3_BRT(6, 5),
1793 PLOT3_BRT(0, 5),
1795
1796/* table for Q */
1797 PLOT3_DRK(0, 2),
1798 PLOT3_BRT(0, 8),
1799 PLOT3_BRT(2, 10),
1800 PLOT3_BRT(6, 10),
1801 PLOT3_BRT(8, 8),
1802 PLOT3_BRT(8, 2),
1803 PLOT3_BRT(6, 0),
1804 PLOT3_BRT(2, 0),
1805 PLOT3_BRT(0, 2),
1806 PLOT3_DRK(5, 3),
1807 PLOT3_BRT(8, 0),
1809
1810/* table for R */
1811 PLOT3_BRT(0, 10),
1812 PLOT3_BRT(6, 10),
1813 PLOT3_BRT(8, 8),
1814 PLOT3_BRT(8, 6),
1815 PLOT3_BRT(6, 5),
1816 PLOT3_BRT(0, 5),
1817 PLOT3_DRK(5, 5),
1818 PLOT3_BRT(8, 0),
1820
1821/* table for S */
1822 PLOT3_DRK(0, 1),
1823 PLOT3_BRT(1, 0),
1824 PLOT3_BRT(6, 0),
1825 PLOT3_BRT(8, 2),
1826 PLOT3_BRT(8, 4),
1827 PLOT3_BRT(6, 6),
1828 PLOT3_BRT(2, 6),
1829 PLOT3_BRT(0, 7),
1830 PLOT3_BRT(0, 9),
1831 PLOT3_BRT(1, 10),
1832 PLOT3_BRT(7, 10),
1833 PLOT3_BRT(8, 9),
1835
1836/* table for T */
1837 PLOT3_DRK(4, 0),
1838 PLOT3_BRT(4, 10),
1839 PLOT3_DRK(0, 10),
1840 PLOT3_BRT(8, 10),
1842
1843/* table for U */
1844 PLOT3_DRK(0, 10),
1845 PLOT3_BRT(0, 2),
1846 PLOT3_BRT(2, 0),
1847 PLOT3_BRT(6, 0),
1848 PLOT3_BRT(8, 2),
1849 PLOT3_BRT(8, 10),
1851
1852/* table for V */
1853 PLOT3_DRK(0, 10),
1854 PLOT3_BRT(4, 0),
1855 PLOT3_BRT(8, 10),
1857
1858/* table for W */
1859 PLOT3_DRK(0, 10),
1860 PLOT3_BRT(1, 0),
1861 PLOT3_BRT(4, 4),
1862 PLOT3_BRT(7, 0),
1863 PLOT3_BRT(8, 10),
1865
1866/* table for X */
1867 PLOT3_BRT(8, 10),
1868 PLOT3_DRK(0, 10),
1869 PLOT3_BRT(8, 0),
1871
1872/* table for Y */
1873 PLOT3_DRK(0, 10),
1874 PLOT3_BRT(4, 4),
1875 PLOT3_BRT(8, 10),
1876 PLOT3_DRK(4, 4),
1877 PLOT3_BRT(4, 0),
1879
1880/* table for Z */
1881 PLOT3_DRK(0, 10),
1882 PLOT3_BRT(8, 10),
1883 PLOT3_BRT(0, 0),
1884 PLOT3_BRT(8, 0),
1886
1887/* table for [ */
1888 PLOT3_DRK(6, 0),
1889 PLOT3_BRT(4, 0),
1890 PLOT3_BRT(4, 10),
1891 PLOT3_BRT(6, 10),
1893
1894/* table for \ */
1895 PLOT3_DRK(0, 10),
1896 PLOT3_BRT(8, 0),
1898
1899/* table for ] */
1900 PLOT3_DRK(2, 0),
1901 PLOT3_BRT(4, 0),
1902 PLOT3_BRT(4, 10),
1903 PLOT3_BRT(2, 10),
1905
1906/* table for ^ */
1907 PLOT3_DRK(4, 0),
1908 PLOT3_BRT(4, 10),
1909 PLOT3_DRK(2, 8),
1910 PLOT3_BRT(4, 10),
1911 PLOT3_BRT(6, 8),
1913
1914/* table for _ */
1915 PLOT3_DNEG(0, 1),
1916 PLOT3_BNEG(11, 1),
1918
1919/* table for ascii 96: accent */
1920 PLOT3_DRK(3, 10),
1921 PLOT3_BRT(5, 6),
1922 PLOT3_BRT(4, 10),
1923 PLOT3_BRT(3, 10),
1925
1926/* table for a */
1927 PLOT3_DRK(0, 5),
1928 PLOT3_BRT(1, 6),
1929 PLOT3_BRT(6, 6),
1930 PLOT3_BRT(7, 5),
1931 PLOT3_BRT(7, 1),
1932 PLOT3_BRT(8, 0),
1933 PLOT3_DRK(7, 1),
1934 PLOT3_BRT(6, 0),
1935 PLOT3_BRT(1, 0),
1936 PLOT3_BRT(0, 1),
1937 PLOT3_BRT(0, 2),
1938 PLOT3_BRT(1, 3),
1939 PLOT3_BRT(6, 3),
1940 PLOT3_BRT(7, 2),
1942
1943/* table for b */
1944 PLOT3_BRT(0, 10),
1945 PLOT3_DRK(8, 3),
1946 PLOT3_BRT(7, 5),
1947 PLOT3_BRT(4, 6),
1948 PLOT3_BRT(1, 5),
1949 PLOT3_BRT(0, 3),
1950 PLOT3_BRT(1, 1),
1951 PLOT3_BRT(4, 0),
1952 PLOT3_BRT(7, 1),
1953 PLOT3_BRT(8, 3),
1955
1956/* table for c */
1957 PLOT3_DRK(8, 5),
1958 PLOT3_BRT(7, 6),
1959 PLOT3_BRT(2, 6),
1960 PLOT3_BRT(0, 4),
1961 PLOT3_BRT(0, 4),
1962 PLOT3_BRT(0, 2),
1963 PLOT3_BRT(2, 0),
1964 PLOT3_BRT(7, 0),
1965 PLOT3_BRT(8, 1),
1967
1968/* table for d */
1969 PLOT3_DRK(8, 0),
1970 PLOT3_BRT(8, 10),
1971 PLOT3_DRK(8, 3),
1972 PLOT3_BRT(7, 5),
1973 PLOT3_BRT(4, 6),
1974 PLOT3_BRT(1, 5),
1975 PLOT3_BRT(0, 3),
1976 PLOT3_BRT(1, 1),
1977 PLOT3_BRT(4, 0),
1978 PLOT3_BRT(7, 1),
1979 PLOT3_BRT(8, 3),
1981
1982/* table for e */
1983 PLOT3_DRK(0, 4),
1984 PLOT3_BRT(1, 3),
1985 PLOT3_BRT(7, 3),
1986 PLOT3_BRT(8, 4),
1987 PLOT3_BRT(8, 5),
1988 PLOT3_BRT(7, 6),
1989 PLOT3_BRT(1, 6),
1990 PLOT3_BRT(0, 5),
1991 PLOT3_BRT(0, 1),
1992 PLOT3_BRT(1, 0),
1993 PLOT3_BRT(7, 0),
1994 PLOT3_BRT(8, 1),
1996
1997/* table for f */
1998 PLOT3_DRK(2, 0),
1999 PLOT3_BRT(2, 9),
2000 PLOT3_BRT(3, 10),
2001 PLOT3_BRT(5, 10),
2002 PLOT3_BRT(6, 9),
2003 PLOT3_DRK(1, 5),
2004 PLOT3_BRT(4, 5),
2006
2007/* table for g */
2008 PLOT3_DRK(8, 6),
2009 PLOT3_DRK(8, 3),
2010 PLOT3_BRT(7, 5),
2011 PLOT3_BRT(4, 6),
2012 PLOT3_BRT(1, 5),
2013 PLOT3_BRT(0, 3),
2014 PLOT3_BRT(1, 1),
2015 PLOT3_BRT(4, 0),
2016 PLOT3_BRT(7, 1),
2017 PLOT3_BRT(8, 3),
2018 PLOT3_BNEG(8, 2),
2019 PLOT3_BNEG(7, 3),
2020 PLOT3_BNEG(1, 3),
2021 PLOT3_BNEG(0, 2),
2023
2024/* table for h */
2025 PLOT3_BRT(0, 10),
2026 PLOT3_DRK(0, 4),
2027 PLOT3_BRT(2, 6),
2028 PLOT3_BRT(6, 6),
2029 PLOT3_BRT(8, 4),
2030 PLOT3_BRT(8, 0),
2032
2033/* table for i */
2034 PLOT3_DRK(4, 0),
2035 PLOT3_BRT(4, 6),
2036 PLOT3_BRT(3, 6),
2037 PLOT3_DRK(4, 9),
2038 PLOT3_BRT(4, 8),
2039 PLOT3_DRK(3, 0),
2040 PLOT3_BRT(5, 0),
2042
2043/* table for j */
2044 PLOT3_DRK(5, 6),
2045 PLOT3_BRT(6, 6),
2046 PLOT3_BNEG(6, 2),
2047 PLOT3_BNEG(5, 3),
2048 PLOT3_BNEG(3, 3),
2049 PLOT3_BNEG(2, 2),
2051
2052/* table for k */
2053 PLOT3_BRT(2, 0),
2054 PLOT3_BRT(2, 10),
2055 PLOT3_BRT(0, 10),
2056 PLOT3_DRK(2, 4),
2057 PLOT3_BRT(4, 4),
2058 PLOT3_BRT(8, 6),
2059 PLOT3_DRK(4, 4),
2060 PLOT3_BRT(8, 0),
2062
2063/* table for l */
2064 PLOT3_DRK(3, 10),
2065 PLOT3_BRT(4, 10),
2066 PLOT3_BRT(4, 2),
2067 PLOT3_BRT(5, 0),
2069
2070/* table for m */
2071 PLOT3_BRT(0, 6),
2072 PLOT3_DRK(0, 5),
2073 PLOT3_BRT(1, 6),
2074 PLOT3_BRT(3, 6),
2075 PLOT3_BRT(4, 5),
2076 PLOT3_BRT(4, 0),
2077 PLOT3_DRK(4, 5),
2078 PLOT3_BRT(5, 6),
2079 PLOT3_BRT(7, 6),
2080 PLOT3_BRT(8, 5),
2081 PLOT3_BRT(8, 0),
2083
2084/* table for n */
2085 PLOT3_BRT(0, 6),
2086 PLOT3_DRK(0, 4),
2087 PLOT3_BRT(2, 6),
2088 PLOT3_BRT(6, 6),
2089 PLOT3_BRT(8, 4),
2090 PLOT3_BRT(8, 0),
2092
2093/* table for o */
2094 PLOT3_DRK(8, 3),
2095 PLOT3_BRT(7, 5),
2096 PLOT3_BRT(4, 6),
2097 PLOT3_BRT(1, 5),
2098 PLOT3_BRT(0, 3),
2099 PLOT3_BRT(1, 1),
2100 PLOT3_BRT(4, 0),
2101 PLOT3_BRT(7, 1),
2102 PLOT3_BRT(8, 3),
2104
2105/* table for p */
2106 PLOT3_DRK(0, 6),
2107 PLOT3_BNEG(0, 3),
2108 PLOT3_DRK(8, 3),
2109 PLOT3_BRT(7, 5),
2110 PLOT3_BRT(4, 6),
2111 PLOT3_BRT(1, 5),
2112 PLOT3_BRT(0, 3),
2113 PLOT3_BRT(1, 1),
2114 PLOT3_BRT(4, 0),
2115 PLOT3_BRT(7, 1),
2116 PLOT3_BRT(8, 3),
2118
2119/* table for q */
2120 PLOT3_DRK(8, 6),
2121 PLOT3_DRK(8, 3),
2122 PLOT3_BRT(7, 5),
2123 PLOT3_BRT(4, 6),
2124 PLOT3_BRT(1, 5),
2125 PLOT3_BRT(0, 3),
2126 PLOT3_BRT(1, 1),
2127 PLOT3_BRT(4, 0),
2128 PLOT3_BRT(7, 1),
2129 PLOT3_BRT(8, 3),
2130 PLOT3_BNEG(8, 3),
2131 PLOT3_BNEG(9, 3),
2133
2134/* table for r */
2135 PLOT3_BRT(1, 0),
2136 PLOT3_BRT(1, 6),
2137 PLOT3_BRT(0, 6),
2138 PLOT3_DRK(1, 4),
2139 PLOT3_BRT(3, 6),
2140 PLOT3_BRT(6, 6),
2141 PLOT3_BRT(8, 4),
2143
2144/* table for s */
2145 PLOT3_DRK(0, 1),
2146 PLOT3_BRT(1, 0),
2147 PLOT3_BRT(7, 0),
2148 PLOT3_BRT(8, 1),
2149 PLOT3_BRT(7, 2),
2150 PLOT3_BRT(1, 4),
2151 PLOT3_BRT(0, 5),
2152 PLOT3_BRT(1, 6),
2153 PLOT3_BRT(7, 6),
2154 PLOT3_BRT(8, 5),
2156
2157/* table for t */
2158 PLOT3_DRK(7, 1),
2159 PLOT3_BRT(6, 0),
2160 PLOT3_BRT(4, 0),
2161 PLOT3_BRT(3, 1),
2162 PLOT3_BRT(3, 10),
2163 PLOT3_BRT(2, 10),
2164 PLOT3_DRK(1, 5),
2165 PLOT3_BRT(5, 5),
2167
2168/* table for u */
2169 PLOT3_DRK(0, 6),
2170 PLOT3_BRT(1, 6),
2171 PLOT3_BRT(1, 1),
2172 PLOT3_BRT(2, 0),
2173 PLOT3_BRT(6, 0),
2174 PLOT3_BRT(7, 1),
2175 PLOT3_BRT(7, 6),
2176 PLOT3_DRK(7, 1),
2177 PLOT3_BRT(8, 0),
2179
2180/* table for v */
2181 PLOT3_DRK(0, 6),
2182 PLOT3_BRT(4, 0),
2183 PLOT3_BRT(8, 6),
2185
2186/* table for w */
2187 PLOT3_DRK(0, 6),
2188 PLOT3_BRT(0, 5),
2189 PLOT3_BRT(2, 0),
2190 PLOT3_BRT(4, 5),
2191 PLOT3_BRT(6, 0),
2192 PLOT3_BRT(8, 5),
2193 PLOT3_BRT(8, 6),
2195
2196/* table for x */
2197 PLOT3_BRT(8, 6),
2198 PLOT3_DRK(0, 6),
2199 PLOT3_BRT(8, 0),
2201
2202/* table for y */
2203 PLOT3_DRK(0, 6),
2204 PLOT3_BRT(0, 1),
2205 PLOT3_BRT(1, 0),
2206 PLOT3_BRT(7, 0),
2207 PLOT3_BRT(8, 1),
2208 PLOT3_DRK(8, 6),
2209 PLOT3_BNEG(8, 2),
2210 PLOT3_BNEG(7, 3),
2211 PLOT3_BNEG(1, 3),
2212 PLOT3_BNEG(0, 2),
2214
2215/* table for z */
2216 PLOT3_DRK(0, 6),
2217 PLOT3_BRT(8, 6),
2218 PLOT3_BRT(0, 0),
2219 PLOT3_BRT(8, 0),
2221
2222/* table for ascii 123, left brace */
2223 PLOT3_DRK(6, 10),
2224 PLOT3_BRT(5, 10),
2225 PLOT3_BRT(4, 9),
2226 PLOT3_BRT(4, 6),
2227 PLOT3_BRT(3, 5),
2228 PLOT3_BRT(4, 4),
2229 PLOT3_BRT(4, 1),
2230 PLOT3_BRT(5, 0),
2231 PLOT3_BRT(6, 0),
2233
2234/* table for ascii 124, vertical bar */
2235 PLOT3_DRK(4, 4),
2236 PLOT3_BRT(4, 0),
2237 PLOT3_BRT(5, 0),
2238 PLOT3_BRT(5, 4),
2239 PLOT3_BRT(4, 4),
2240 PLOT3_DRK(4, 6),
2241 PLOT3_BRT(4, 10),
2242 PLOT3_BRT(5, 10),
2243 PLOT3_BRT(5, 6),
2244 PLOT3_BRT(4, 6),
2246
2247/* table for ascii 125, right brace */
2248 PLOT3_DRK(2, 0),
2249 PLOT3_BRT(3, 0),
2250 PLOT3_BRT(4, 1),
2251 PLOT3_BRT(4, 4),
2252 PLOT3_BRT(5, 5),
2253 PLOT3_BRT(4, 6),
2254 PLOT3_BRT(4, 9),
2255 PLOT3_BRT(3, 10),
2256 PLOT3_BRT(2, 10),
2258
2259/* table for ascii 126, tilde */
2260 PLOT3_DRK(0, 5),
2261 PLOT3_BRT(1, 6),
2262 PLOT3_BRT(3, 6),
2263 PLOT3_BRT(5, 4),
2264 PLOT3_BRT(7, 4),
2265 PLOT3_BRT(8, 5),
2267
2268/* table for ascii 127, rubout */
2269 PLOT3_DRK(0, 2),
2270 PLOT3_BRT(0, 8),
2271 PLOT3_BRT(8, 8),
2272 PLOT3_BRT(8, 2),
2273 PLOT3_BRT(0, 2),
2275};
2276
2277static void
2278plot3_mat_mul(mat_t o, const mat_t a, const mat_t b)
2279{
2280 mat_t t;
2281 int row;
2282 int col;
2283
2284 for (row = 0; row < 4; row++) {
2285 for (col = 0; col < 4; col++) {
2286 t[row*4 + col] = a[row*4 + 0] * b[col + 0]
2287 + a[row*4 + 1] * b[col + 4]
2288 + a[row*4 + 2] * b[col + 8]
2289 + a[row*4 + 3] * b[col + 12];
2290 }
2291 }
2292
2293 MAT_COPY(o, t);
2294}
2295
2296static void
2297plot3_mat_zrot(mat_t mat, double theta)
2298{
2299 double rad = theta * DEG2RAD;
2300 double s = sin(rad);
2301 double c = cos(rad);
2302
2303 MAT_IDN(mat);
2304 mat[0] = c;
2305 mat[1] = -s;
2306 mat[4] = s;
2307 mat[5] = c;
2308}
2309
2310static void
2311plot3_vec_ortho(vect_t out, const vect_t in)
2312{
2313 vect_t a;
2314
2315 if (fabs(in[X]) <= fabs(in[Y]) && fabs(in[X]) <= fabs(in[Z])) {
2316 VSET(a, 1, 0, 0);
2317 } else if (fabs(in[Y]) <= fabs(in[Z])) {
2318 VSET(a, 0, 1, 0);
2319 } else {
2320 VSET(a, 0, 0, 1);
2321 }
2322
2323 VCROSS(out, in, a);
2324 VUNITIZE(out);
2325}
2326
2327static void
2328plot3_font_setup(void)
2329{
2330 int *p = plot3_font_table;
2331 int i;
2332
2333 for (i = 040 - PLOT3_NUM_SYMBOLS; i < 128; i++) {
2334 plot3_font_index[i+128] = plot3_font_index[i] = p;
2335 while ((*p++) != PLOT3_FONT_LAST)
2336 ;
2337 }
2338 for (i = 1; i <= PLOT3_NUM_SYMBOLS; i++) {
2340 }
2341 for (i = PLOT3_NUM_SYMBOLS + 1; i < 040; i++) {
2342 plot3_font_index[i+128] = plot3_font_index[i] = plot3_font_index[(unsigned char)'?'];
2343 }
2344}
2345
2346int *
2347plot3_font_getchar(const unsigned char *c)
2348{
2349 if (plot3_font_index[040] == 0)
2351 return plot3_font_index[*c];
2352}
2353
2354void
2355pl_list(FILE *fp, int *x, int *y, int npoints)
2356{
2357 if (npoints <= 0)
2358 return;
2359
2360 pl_move(fp, *x++, *y++);
2361 while (--npoints > 0)
2362 pl_cont(fp, *x++, *y++);
2363}
2364
2365void
2366pd_list(FILE *fp, double *x, double *y, int npoints)
2367{
2368 if (npoints <= 0)
2369 return;
2370
2371 pd_move(fp, *x++, *y++);
2372 while (--npoints > 0)
2373 pd_cont(fp, *x++, *y++);
2374}
2375
2376void
2377pd_3list(FILE *fp, double *x, double *y, double *z, int npoints)
2378{
2379 if (npoints <= 0)
2380 return;
2381
2382 pd_3move(fp, *x++, *y++, *z++);
2383 while (--npoints > 0)
2384 pd_3cont(fp, *x++, *y++, *z++);
2385}
2386
2387void
2388pd_marked_list(FILE *fp, double *x, double *y, int npoints, int flag, int mark, int interval, double size)
2389{
2390 int i;
2391 int counter;
2392
2393 if (npoints <= 0)
2394 return;
2395
2396 if (flag & PLOT3_LINE)
2397 pd_list(fp, x, y, npoints);
2398 if (flag & PLOT3_MARK) {
2399 pd_marker(fp, mark, *x++, *y++, size);
2400 counter = 1;
2401 for (i = 1; i < npoints; i++) {
2402 if (counter >= interval) {
2403 pd_marker(fp, mark, *x, *y, size);
2404 counter = 0;
2405 }
2406 x++;
2407 y++;
2408 counter++;
2409 }
2410 }
2411}
2412
2413void
2414pd_marker(FILE *fp, int c, double x, double y, double scale)
2415{
2416 char mark_str[4];
2417
2418 mark_str[0] = (char)c;
2419 mark_str[1] = '\0';
2420 pd_symbol(fp, mark_str, x - scale*0.5, y - scale*0.5, scale, 0.0);
2421}
2422
2423void
2424pd_3marker(FILE *fp, int c, double x, double y, double z, double scale)
2425{
2426 char mark_str[4];
2427 mat_t mat;
2428 vect_t p;
2429
2430 mark_str[0] = (char)c;
2431 mark_str[1] = '\0';
2432 MAT_IDN(mat);
2433 VSET(p, x - scale*0.5, y - scale*0.5, z);
2434 pdv_3symbol(fp, mark_str, p, mat, scale);
2435}
2436
2437void
2438pdv_3symbol(FILE *fp, char *string, point_t origin, mat_t rot, double scale)
2439{
2440 unsigned char *cp;
2441 double offset;
2442 int ysign;
2443 vect_t temp;
2444 vect_t loc;
2446 mat_t mat;
2447
2448 if (string == NULL || *string == '\0')
2449 return;
2450
2454
2455 offset = 0;
2456 for (cp = (unsigned char *)string; *cp; cp++, offset += scale) {
2457 int *p;
2458 int stroke;
2459
2460 VSET(temp, offset, 0, 0);
2461 MAT4X3PNT(loc, mat, temp);
2462 pdv_3move(fp, loc);
2463
2464 for (p = plot3_font_getchar(cp); (stroke = *p) != PLOT3_FONT_LAST; p++) {
2465 int draw;
2466
2467 if (stroke == PLOT3_FONT_NEGY) {
2468 ysign = -1;
2469 stroke = *++p;
2470 } else {
2471 ysign = 1;
2472 }
2473
2474 if (stroke < 0) {
2475 stroke = -stroke;
2476 draw = 0;
2477 } else {
2478 draw = 1;
2479 }
2480
2481 VSET(temp, (stroke/11) * 0.1 * scale + offset,
2482 ysign * (stroke%11) * 0.1 * scale, 0);
2483 MAT4X3PNT(loc, mat, temp);
2484 if (draw)
2485 pdv_3cont(fp, loc);
2486 else
2487 pdv_3move(fp, loc);
2488 }
2489 }
2490}
2491
2492void
2493pd_symbol(FILE *fp, char *string, double x, double y, double scale, double theta)
2494{
2495 mat_t mat;
2496 vect_t p;
2497
2498 plot3_mat_zrot(mat, theta);
2499 VSET(p, x, y, 0);
2500 pdv_3symbol(fp, string, p, mat, scale);
2501}
2502
2503void
2505{
2506 fastf_t len;
2508 vect_t diff;
2509 vect_t c1, c2;
2510 vect_t h1, h2;
2511 vect_t backup;
2512 point_t tip;
2513
2515
2516 VSUB2(diff, to, from);
2518 return;
2519 VSCALE(diff, diff, 1/len);
2521 VCROSS(c2, c1, diff);
2522
2523 if (!ZERO(fromheadfract)) {
2526
2527 VSCALE(h1, c1, hooklen);
2528 VADD3(tip, from, h1, backup);
2531
2532 VSCALE(h2, c2, hooklen);
2533 VADD3(tip, from, h2, backup);
2535 }
2536 if (!ZERO(toheadfract)) {
2539
2540 VSCALE(h1, c1, hooklen);
2541 VADD3(tip, to, h1, backup);
2544
2545 VSCALE(h2, c2, hooklen);
2546 VADD3(tip, to, h2, backup);
2548 }
2551}
2552
2553void
2554pdv_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)
2555{
2556 int i;
2557 int nticks;
2566 vect_t temp;
2567 vect_t diff;
2569 mat_t mat;
2570 char fmt[32];
2571 char str[64];
2572
2573 if (ccw)
2574 ccw = -1;
2575 else
2576 ccw = 1;
2577
2578 if (ZERO(tick_separation))
2579 tick_separation = 1;
2580
2582 MAT_DELTAS_VEC(xlate_to_0, origin);
2584 VMOVE(cur_point, origin);
2585
2586 VSET(temp, 0, -PLOT3_TICK_YLEN * ccw, 0);
2587 MAT4X3PNT(tick_bottom, mat, temp);
2588
2589 VSET(temp, 0, -PLOT3_NUM_YOFF * ccw, 0);
2590 MAT4X3PNT(num_center, mat, temp);
2593
2594 VSET(temp, 1, 0, 0);
2595 MAT4X3VEC(axis_dir, mat, temp);
2597
2598 VSET(temp, 0.5*(length - strlen(string)*char_width), -PLOT3_TITLE_YOFF*ccw, 0);
2599 MAT4X3PNT(title_left, mat, temp);
2600 pdv_3symbol(fp, string, title_left, rot, char_width);
2601
2603 pdv_3move(fp, cur_point);
2604 for (i = 0; i <= nticks; i++) {
2606
2607 if (ndigits > 0) {
2608 double f;
2609 if (ndigits > 63)
2610 ndigits = 63;
2611 snprintf(fmt, 32, "%%%dg", ndigits);
2612 snprintf(str, 64, fmt, label_start);
2613 f = strlen(str) * char_width * 0.5;
2615
2617 if (VDOT(diff, axis_dir) >= 0) {
2618 pdv_3symbol(fp, str, num_start, rot, char_width);
2620 }
2621 }
2622
2623 if (i == nticks)
2624 break;
2625
2626 pdv_3move(fp, cur_point);
2630
2632 pdv_3cont(fp, cur_point);
2633 }
2634}
2635
2636void
2637plot3_float_split(float x, float *coef, int *ex)
2638{
2639 int i, isv;
2640 float xx;
2641
2642 isv = 1;
2643 if (x < 0.0) {
2644 isv = -1;
2645 x = -x;
2646 }
2647
2648 if (x > 1.0) {
2649 xx = x;
2650 *ex = 0;
2651 *coef = 0.0;
2652
2653 if (xx < 10.0) {
2654 *coef = xx*isv;
2655 return;
2656 }
2657
2658 for (i = 1; i < 39; ++i) {
2659 *ex += 1;
2660 xx = xx/10.0;
2661 if (xx < 10.0)
2662 break;
2663 }
2664 *coef = xx*isv;
2665 return;
2666 }
2667
2668 xx = x;
2669 *ex = 0;
2670 *coef = 0.0;
2671 for (i = 1; i < 39; ++i) {
2672 *ex -= 1;
2673 xx *= 10.0;
2674 if (xx >= 1.0)
2675 break;
2676 }
2677 *coef = xx*isv;
2678}
2679
2680double
2681plot3_ipow(double x, int n)
2682{
2683 return n > 0 ? x*plot3_ipow(x, n-1) : 1;
2684}
2685
2686void
2687plot3_scale_fit(float *x, int npts, float size, float *xs, float *xmin, float *xmax, float *dx)
2688{
2689 float txmi, txma, coef, delta, diff;
2690 int i, ex;
2691
2692 txmi = txma = x[0];
2693 i = 0;
2694 while (i <= npts) {
2695 V_MIN(txmi, x[i]);
2696 V_MAX(txma, x[i]);
2697 i++;
2698 }
2699
2700 diff = txma - txmi;
2701 V_MAX(diff, 0.000001f);
2702
2704 if (coef < 2.0f)
2705 delta = .1f;
2706 else if (coef < 4.0f)
2707 delta = .2f;
2708 else
2709 delta = .5f;
2710
2711 i = 0;
2712 if (ex < 0) {
2713 ex = -ex;
2714 i = 12;
2715 }
2716
2717 delta *= plot3_ipow(10.0, ex);
2718 if (i == 12)
2719 delta = 1.0/delta;
2720 *dx = delta;
2721
2722 i = (fabs(txmi)/delta);
2723 *xmin = i*delta;
2724 if (txmi < 0.0f)
2725 *xmin = -(*xmin+delta);
2726
2727 i = (fabs(txma)/delta);
2728 *xmax = i*delta;
2729 if (txma < 0.0f)
2730 *xmax = -*xmax;
2731 else
2732 *xmax = *xmax+delta;
2733 *xs = 1000.0f*size/(*xmax - *xmin);
2734}
2735
2736void
2737plot3_xy_plot(FILE *fp, int xp, int yp, int xl, int yl, char *xtitle, char *ytitle, float *x, float *y, int n, double cscale)
2738{
2739 int ddx = 0, ddy = 0, xend = 0, yend = 0, xpen = 0, ypen = 0;
2740 float fxl = 0.0, fyl = 0.0, xs = 0.0, ys = 0.0, xmin = 0.0, xmax = 0.0, ymin = 0.0, ymax = 0.0, dx = 0.0, dy = 0.0;
2741 float lab = 0.0;
2742 int xtics = 0, ytics = 0, i = 0, xtl = 0, ytl = 0, j = 0;
2743 int ix[101] = {0}, iy[101] = {0}, isave = 0;
2744 char str[32] = {0};
2745
2746 if (xl == 0) {
2747 j = 0;
2748 goto loop;
2749 }
2750 fxl = xl/1000.0;
2751 fyl = yl/1000.0;
2752 n -= 1;
2753 plot3_scale_fit(x, n, fxl, &xs, &xmin, &xmax, &dx);
2754 plot3_scale_fit(y, n, fyl, &ys, &ymin, &ymax, &dy);
2755 ddx = dx*xs;
2756 ddy = dy*ys;
2757 xtics = PLOT3_LAB_LNGTH / ddx + 1.0;
2758 ytics = 500/ddy + 1.0;
2759 xend = xl+xp;
2760 xpen = xp;
2761
2762 pl_move(fp, xpen, yp-PLOT3_TIC);
2763 pl_cont(fp, xpen, yp);
2764
2765 lab = xmin;
2766 snprintf(str, 32, "%3.3g", xmin);
2767 pd_symbol(fp, str, (double)(xpen-171), (double)(yp-PLOT3_TIC-PLOT3_NUM_DISTANCE), cscale, 0.0);
2768
2769 i = 0;
2770 while ((xpen+ddx) <= xend) {
2771 i++;
2772 xpen += ddx;
2773 pl_line(fp, xpen, yp, xpen, yp-PLOT3_TIC);
2774 lab += dx;
2775 if ((i%xtics) == 0) {
2776 snprintf(str, 32, "%3.3g", lab);
2777 pd_symbol(fp, str, (double)(xpen-171), (double)(yp-PLOT3_TIC-PLOT3_NUM_DISTANCE), cscale, 0.0);
2778 }
2779 }
2780
2781 xtl = xp+(xl - strlen(xtitle)*cscale)/2;
2782 ytl = yp - 8 * cscale;
2783 pd_symbol(fp, xtitle, (double)xtl, (double)ytl, 100.0, 0.0);
2784 yend = yl+yp;
2785 ypen = yp;
2786 pl_line(fp, xp-PLOT3_TIC, ypen, xp, ypen);
2787
2788 lab = ymin;
2789 snprintf(str, 32, "%3.3g", lab);
2790 pd_symbol(fp, str, (double)(xp-PLOT3_TIC-PLOT3_LAB_LNGTH-PLOT3_NUM_DISTANCE), (double)ypen, cscale, 0.0);
2791
2792 i = 0;
2793 while ((ypen+ddy) <= yend) {
2794 i++;
2795 ypen += ddy;
2796 pl_line(fp, xp, ypen, xp-PLOT3_TIC, ypen);
2797 lab += dy;
2798 if ((i%ytics) == 0) {
2799 snprintf(str, 32, "%3.3g", lab);
2800 pd_symbol(fp, str, (double)(xp-PLOT3_TIC-PLOT3_LAB_LNGTH-PLOT3_NUM_DISTANCE), (double)ypen, cscale, 0.0);
2801 }
2802 }
2803
2804 xtl = xp-1500;
2805 ytl = yp + (yl - strlen(ytitle)*cscale)/2;
2806 pd_symbol(fp, ytitle, (double)xtl, (double)ytl, 100.0, 90.0);
2807
2808 j = 0;
2809
2810loop:
2811 if (n <= 100) {
2812 isave = n-1;
2813 } else {
2814 isave = 100;
2815 n -= 101;
2816 }
2817
2818 if (j == 0) {
2819 ix[0] = (x[j] - xmin)*xs + xp;
2820 iy[0] = (y[j] - ymin)*ys + yp;
2821 j++;
2822 } else {
2823 ix[0] = (x[j-1] - xmin)*xs + xp;
2824 iy[0] = (y[j-1] - ymin)*ys + yp;
2825 }
2826
2827 i = 1;
2828 while (i <= isave) {
2829 ix[i] = (x[j] - xmin)*xs + xp;
2830 iy[i] = (y[j] - ymin)*ys + yp;
2831 i++;
2832 j++;
2833 }
2834 pl_list(fp, ix, iy, isave+1);
2835 if (isave == 100)
2836 goto loop;
2837}
2838
2839void
2840plot3_float_to_ascii(float x, char *s)
2841{
2842 int ex, tmp;
2843 float coef;
2844 char esgn, nsgn;
2845 char i;
2846
2847 plot3_float_split(x, &coef, &ex);
2848 if (ex < -15) {
2849 ex = 0;
2850 *s++ = '0';
2851 *s++ = '.';
2852 *s++ = '0';
2853 *s++ = '0';
2854 *s++ = '0';
2855 *s++ = 'e';
2856 *s++ = '+';
2857 *s++ = '0';
2858 *s++ = '0';
2859 *s = 0;
2860 return;
2861 }
2862
2863 if (ex < 0) {
2864 esgn = '-';
2865 ex = -ex;
2866 } else {
2867 esgn = '+';
2868 }
2869
2870 if (coef < 0.0) {
2871 nsgn = '-';
2872 coef = -coef;
2873 } else {
2874 nsgn = ' ';
2875 }
2876 *s++ = nsgn;
2877
2878 tmp = coef;
2879 *s++ = tmp + '0';
2880 coef = (coef - tmp)*10.0;
2881 *s++ = '.';
2882
2883 for (i = 1; i <= 3; ++i) {
2884 tmp = coef;
2885 coef = (coef - tmp)*10.0;
2886 *s++ = tmp + '0';
2887 }
2888
2889 *s++ = 'e';
2890 *s++ = esgn;
2891
2892 if (ex < 0)
2893 ex = -ex;
2894
2895 if (ex < 10) {
2896 *s++ = '0';
2897 *s++ = ex + '0';
2898 } else {
2899 tmp = ex/10;
2900 *s++ = tmp + '0';
2901 ex = ex - tmp*10;
2902 *s++ = ex +'0';
2903 }
2904 *s = 0;
2905}
2906
2907void
2908plot3_data_scale(int *idata, int elements, int mode, int length, int *odata, double *min, double *dx)
2909{
2910 double xmax, xmin, x, workdx;
2911 int i;
2912 static double log_10;
2913 float *ifloatp;
2914 double *idoublep;
2915 double fractional;
2916 int integral;
2917
2918 ifloatp = (float *)idata;
2919 idoublep = (double *)idata;
2920 xmax = xmin = 0.0;
2921 for (i = 0; i < elements; i++) {
2922 x = (mode == 'f') ? ifloatp[i] : ((mode == 'd') ? idoublep[i] : idata[i]);
2923 V_MAX(xmax, x);
2924 V_MIN(xmin, x);
2925 }
2926
2927 if (log_10 <= 0.0)
2928 log_10 = log(10.0);
2929
2933
2934 if (fractional < 0.0) {
2935 fractional += 1.0;
2936 integral -= 1;
2937 }
2938
2939 fractional = pow(10.0, fractional);
2940 i = fractional - 0.01;
2941 switch (i) {
2942 case 1:
2943 fractional = 2.0;
2944 break;
2945 case 2:
2946 case 3:
2947 fractional = 4.0;
2948 break;
2949 case 4:
2950 fractional = 5.0;
2951 break;
2952 case 5:
2953 case 6:
2954 case 7:
2955 fractional = 8.0;
2956 break;
2957 case 8:
2958 case 9:
2959 fractional = 10.0;
2960 }
2961
2962 workdx = pow(10.0, (double)integral) * fractional;
2963
2964 for (i = 0; i < elements; i++) {
2965 if (mode == 'f')
2966 odata[i] = (ifloatp[i] - xmin) / workdx;
2967 else if (mode == 'd')
2968 odata[i] = (idoublep[i] - xmin) / workdx;
2969 else
2970 odata[i] = (idata[i] - xmin) / workdx;
2971 }
2972
2973 *min = xmin;
2974 *dx = workdx;
2975}
2976
2977
2978int
2979plot3_invalid(FILE *fp, int mode)
2980{
2981
2982 /* Only two valid modes */
2983 if (mode != PL_OUTPUT_MODE_BINARY && mode != PL_OUTPUT_MODE_TEXT) {
2984 return 1;
2985 }
2986
2987 /* A non-readable file isn't a valid file */
2988 if (!fp) {
2989 return 1;
2990 }
2991
2992 int i = 0;
2993 int c;
2994 unsigned int tchar = 0;
2995
2996 while (!feof(fp) && (c=getc(fp)) != EOF) {
2997 if (c < 'A' || c > 'z') {
2998 return 1;
2999 }
3000 switch (c) {
3001 case 'C':
3002 // TCHAR, 3, "color"
3003 if (mode == PL_OUTPUT_MODE_BINARY) {
3004 for (i = 0; i < 3; i++) {
3005 if (getc(fp) == EOF)
3006 return 1;
3007 }
3008 }
3009 if (mode == PL_OUTPUT_MODE_TEXT) {
3010 i = fscanf(fp, "%u", &tchar);
3011 if (i != 1)
3012 return 1;
3013 }
3014 break;
3015 case 'F':
3016 // TNONE, 0, "flush"
3017 break;
3018 case 'L':
3019 // TSHORT, 6, "3line"
3020 if (read_short(fp, 6, mode))
3021 return 1;
3022 break;
3023 case 'M':
3024 // TSHORT, 3, "3move"
3025 if (read_short(fp, 3, mode))
3026 return 1;
3027 break;
3028 case 'N':
3029 // TSHORT, 3, "3cont"
3030 if (read_short(fp, 3, mode))
3031 return 1;
3032 break;
3033 case 'O':
3034 // TIEEE, 3, "d_3move"
3035 if (read_ieee(fp, 3, mode))
3036 return 1;
3037 break;
3038 case 'P':
3039 // TSHORT, 3, "3point"
3040 if (read_short(fp, 3, mode))
3041 return 1;
3042 break;
3043 case 'Q':
3044 // TIEEE, 3, "d_3cont"
3045 if (read_ieee(fp, 3, mode))
3046 return 1;
3047 break;
3048 case 'S':
3049 // TSHORT, 6, "3space"
3050 if (read_short(fp, 6, mode))
3051 return 1;
3052 break;
3053 case 'V':
3054 // TIEEE, 6, "d_3line"
3055 if (read_ieee(fp, 6, mode))
3056 return 1;
3057 break;
3058 case 'W':
3059 // TIEEE, 6, "d_3space"
3060 if (read_ieee(fp, 6, mode))
3061 return 1;
3062 break;
3063 case 'X':
3064 // TIEEE, 3, "d_3point"
3065 if (read_ieee(fp, 3, mode))
3066 return 1;
3067 break;
3068 case 'a':
3069 // TSHORT, 6, "arc"
3070 if (read_short(fp, 6, mode))
3071 return 1;
3072 break;
3073 case 'c':
3074 // TSHORT, 3, "circle"
3075 if (read_short(fp, 3, mode))
3076 return 1;
3077 break;
3078 case 'e':
3079 // TNONE, 0, "erase"
3080 break;
3081 case 'f':
3082 // TSTRING, 1, "linmod"
3083 if (read_tstring(fp, mode))
3084 return 1;
3085 break;
3086 case 'i':
3087 // TIEEE, 3, "d_circle"
3088 if (read_ieee(fp, 3, mode))
3089 return 1;
3090 break;
3091 case 'l':
3092 // TSHORT, 4, "line"
3093 if (read_short(fp, 4, mode))
3094 return 1;
3095 break;
3096 case 'm':
3097 // TSHORT, 2, "move"
3098 if (read_short(fp, 2, mode))
3099 return 1;
3100 break;
3101 case 'n':
3102 // TSHORT, 2, "cont"
3103 if (read_short(fp, 2, mode))
3104 return 1;
3105 break;
3106 case 'o':
3107 // TIEEE, 2, "d_move"
3108 if (read_ieee(fp, 2, mode))
3109 return 1;
3110 break;
3111 case 'p':
3112 // TSHORT, 2, "point"
3113 if (read_short(fp, 2, mode))
3114 return 1;
3115 break;
3116 case 'q':
3117 // TIEEE, 2, "d_cont"
3118 if (read_ieee(fp, 2, mode))
3119 return 1;
3120 break;
3121 case 'r':
3122 // TIEEE, 6, "d_arc"
3123 if (read_ieee(fp, 6, mode))
3124 return 1;
3125 break;
3126 case 's':
3127 // TSHORT, 4, "space"
3128 if (read_short(fp, 4, mode))
3129 return 1;
3130 break;
3131 case 't':
3132 // TSTRING, 1, "label"
3133 if (read_tstring(fp, mode))
3134 return 1;
3135 break;
3136 case 'v':
3137 // TIEEE, 4, "d_line"
3138 if (read_ieee(fp, 4, mode))
3139 return 1;
3140 break;
3141 case 'w':
3142 // TIEEE, 4, "d_space"
3143 if (read_ieee(fp, 4, mode))
3144 return 1;
3145 break;
3146 case 'x':
3147 // TIEEE, 2, "d_point"
3148 if (read_ieee(fp, 2, mode))
3149 return 1;
3150 break;
3151 default:
3152 return 1;
3153 break;
3154 };
3155 }
3156
3157 return 0;
3158}
3159
3160#endif // PLOT3_IMPLEMENTATION
3161
3162#endif /* PLOT3_H */
3163
3164/** @} */
3165/*
3166 * Local Variables:
3167 * mode: C
3168 * tab-width: 8
3169 * indent-tabs-mode: t
3170 * c-file-style: "stroustrup"
3171 * End:
3172 * ex: shiftwidth=4 tabstop=8
3173 */
Definition dvec.h:74
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
Definition cv.h:100
void bu_cv_htond(unsigned char *out, const unsigned char *in, size_t count)
#define pdv_3vector
Definition plot3.h:190
#define plot3_xy_plot
Definition plot3.h:181
#define pl_3space
Definition plot3.h:156
#define pl_circle
Definition plot3.h:159
#define pd_3list
Definition plot3.h:182
#define pl_line
Definition plot3.h:167
#define PL_OUTPUT_MODE_BINARY
Definition plot3.h:119
#define pl_3move
Definition plot3.h:154
#define PLOT3_FONT_LAST
Definition plot3.h:192
#define pd_3marker
Definition plot3.h:183
#define pd_list
Definition plot3.h:184
#define PLOT3_FONT_NEGY
Definition plot3.h:193
#define pdv_3cont
Definition plot3.h:145
#define pd_box
Definition plot3.h:137
#define pd_3line
Definition plot3.h:132
#define pl_3point
Definition plot3.h:155
#define pl_erase
Definition plot3.h:163
#define pl_3box
Definition plot3.h:151
#define pd_3box
Definition plot3.h:130
#define pdv_3line
Definition plot3.h:146
#define pd_symbol
Definition plot3.h:187
#define pl_color
Definition plot3.h:160
#define pd_space
Definition plot3.h:143
#define pl_point
Definition plot3.h:170
#define pl_flush
Definition plot3.h:164
#define pl_3line
Definition plot3.h:153
#define pl_cont
Definition plot3.h:162
#define pdv_3move
Definition plot3.h:147
#define pd_marked_list
Definition plot3.h:185
#define pl_arc
Definition plot3.h:157
#define plot3_float_to_ascii
Definition plot3.h:177
#define plot3_invalid
Definition plot3.h:174
#define pd_arc
Definition plot3.h:136
#define plot3_font_getchar
Definition plot3.h:178
#define pd_3space
Definition plot3.h:135
#define plot3_float_split
Definition plot3.h:176
#define pdv_3box
Definition plot3.h:144
#define pl_label
Definition plot3.h:166
#define plot3_ipow
Definition plot3.h:179
#define PLOT3_EXPORT
Definition plot3.h:114
#define pd_point
Definition plot3.h:142
#define pl_3cont
Definition plot3.h:152
#define plot3_data_scale
Definition plot3.h:175
#define pd_circle
Definition plot3.h:138
#define pdv_3point
Definition plot3.h:148
#define pl_linmod
Definition plot3.h:168
#define pdv_3axis
Definition plot3.h:188
#define pl_color_buc
Definition plot3.h:161
#define pd_move
Definition plot3.h:141
#define plot3_scale_fit
Definition plot3.h:180
#define pd_cont
Definition plot3.h:139
#define pdv_3symbol
Definition plot3.h:189
#define pl_box
Definition plot3.h:158
#define pl_move
Definition plot3.h:169
#define pl_space
Definition plot3.h:172
#define pdv_3ray
Definition plot3.h:149
#define pd_marker
Definition plot3.h:186
#define pl_getOutputMode
Definition plot3.h:165
#define pd_3move
Definition plot3.h:133
#define pl_setOutputMode
Definition plot3.h:171
#define pd_3point
Definition plot3.h:134
#define PL_OUTPUT_MODE_TEXT
Definition plot3.h:120
#define pl_list
Definition plot3.h:173
#define pd_3cont
Definition plot3.h:131
#define pdv_3space
Definition plot3.h:150
#define pd_line
Definition plot3.h:140
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition vmath.h:348
#define VUNITIZE(v)
Normalize vector ‘v’ to be a unit vector.
Definition vmath.h:1140
#define V_MAX(r, s)
Definition vmath.h:1724
double fastf_t
fastest 64-bit (or larger) floating point type
Definition vmath.h:333
#define VADD2(o, a, b)
Add 3D vectors at ‘a’ and ‘b’, store result at ‘o’.
Definition vmath.h:928
#define VCROSS(o, a, b)
Store cross product of 3D vectors at ‘a’ and ‘b’ in vector at ‘o’.
Definition vmath.h:1418
#define MAT_IDN(m)
Set matrix to identity.
Definition vmath.h:766
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition vmath.h:369
#define VMOVE(o, v)
Transfer 3D vector at ‘v’ to vector at ‘o’.
Definition vmath.h:864
#define VSCALE(o, v, s)
Scale 3D vector at ‘v’ by scalar ‘s’, store result at ‘o’.
Definition vmath.h:1108
#define VSUB2(o, a, b)
Subtract 3D vector at ‘b’ from vector at ‘a’, store result at ‘o’.
Definition vmath.h:964
#define VADD3(o, a, b, c)
Add 3 3D vectors at ‘a’, ‘b’, and ‘c’, store result at ‘o’.
Definition vmath.h:1033
#define MAT_COPY(c, m)
Copy a matrix ‘m’ into ‘c’.
Definition vmath.h:799
#define VJOIN1(o, a, sb, b)
Definition vmath.h:1298
#define VDOT(a, b)
Compute dot product of vectors at ‘a’ and ‘b’.
Definition vmath.h:1439
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition vmath.h:354
#define VSET(o, a, b, c)
Set 3D vector at ‘o’ to have coordinates ‘a’, ‘b’, and ‘c’.
Definition vmath.h:819
#define V_MIN(r, s)
Included below are macros to update min and max X, Y, Z values to contain a point.
Definition vmath.h:1722
#define SQRT_SMALL_FASTF
Definition vmath.h:246
#define MAT4X3PNT(o, m, i)
Apply a 4x4 matrix to a 3-tuple which is an absolute Point in space. Output and input points should b...
Definition vmath.h:1648
#define V3ARGS(a)
Definition vmath.h:1506
#define MAGNITUDE(v)
Return scalar magnitude of the 3D vector ‘a’. This is otherwise known as the Euclidean norm of the pr...
Definition vmath.h:1395
#define MAT_DELTAS_VEC(_m, _v)
set translation values of 4x4 matrix from a vector.
Definition vmath.h:601
#define DEG2RAD
Definition vmath.h:191
#define ZERO(_a)
Definition vmath.h:497
#define MAT4X3VEC(o, m, i)
Apply a 4x4 matrix to a 3-tuple which is a relative Vector in space. This macro can scale the length ...
Definition vmath.h:1684
@ Y
Definition vmath.h:401
@ X
Definition vmath.h:400
@ Z
Definition vmath.h:402
NMG topological loop.
Definition topology.h:181
fundamental vector, matrix, quaternion math macros