plot3.c

Go to the documentation of this file.
00001 /*                         P L O T 3 . C
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 2004-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 
00022 /** \addtogroup plot */
00023 /*@{*/
00024 /** @file plot3.c
00025  * @brief
00026  *  A public-domain UNIX plot library, for 2-D and 3-D plotting in
00027  *  16-bit VAX signed integer spaces, or 64-bit IEEE floating point.
00028  *
00029  *  These routines generate "UNIX plot" output (with the addition
00030  *  of 3-D commands).  They behave almost exactly like the regular
00031  *  libplot routines, except:
00032  *
00033  *  -# These all take a stdio file pointer, and can thus be used to create multiple plot files simultaneously.
00034  *  -# There are 3-D versions of most commands.
00035  *  -# There are IEEE floating point versions of the commands.
00036  *  -# The names have been changed.
00037  *
00038  *  The 3-D extensions are those of Doug Gwyn, from his System V extensions.
00039  *
00040  *  Author -
00041  *      Phillip Dykstra
00042  *      24 Sep 1986
00043  *
00044  *  Source -
00045  *      SECAD/VLD Computing Consortium, Bldg 394
00046  *      The U. S. Army Ballistic Research Laboratory
00047  *      Aberdeen Proving Ground, Maryland  21005-5066
00048  *
00049  */
00050 
00051 
00052 #ifndef lint
00053 static const char RCSid[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/libbn/plot3.c,v 14.11 2006/09/04 04:42:40 lbutler Exp $ (BRL)";
00054 #endif
00055 
00056 #include "common.h"
00057 
00058 
00059 
00060 #include <stdio.h>
00061 
00062 #include "machine.h"
00063 #include "vmath.h"
00064 #include "plot3.h"
00065 
00066 
00067 static int pl_outputMode = PL_OUTPUT_MODE_BINARY;
00068 
00069 /* For the sake of efficiency, we trust putc() to write only one byte */
00070 /*#define putsi(a)      putc(a&0377,plotfp); putc((a>>8)&0377,plotfp)*/
00071 #define putsi(a)        putc(a,plotfp); putc((a>>8),plotfp)
00072 
00073 
00074 /*
00075  *  These interfaces provide the standard UNIX-Plot functionality
00076  */
00077 
00078 int
00079 pl_getOutputMode() {
00080     return pl_outputMode;
00081 }
00082 
00083 void
00084 pl_setOutputMode(int mode) {
00085     pl_outputMode = mode;
00086 }
00087 
00088 /**
00089  * @brief
00090  * plot a point
00091  */
00092 void
00093 pl_point(register FILE *plotfp, int x, int y)
00094 {
00095     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00096         putc( 'p', plotfp );
00097         putsi( x );
00098         putsi( y );
00099     } else {
00100         fprintf(plotfp, "p %d %d\n", x, y);
00101     }
00102 }
00103 
00104 void
00105 pl_line(register FILE *plotfp, int x1, int y1, int x2, int y2)
00106 {
00107     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00108         putc( 'l', plotfp );
00109         putsi( x1 );
00110         putsi( y1 );
00111         putsi( x2 );
00112         putsi( y2 );
00113     } else {
00114         fprintf(plotfp, "l %d %d %d %d\n", x1, y1, x2, y2);
00115     }
00116 }
00117 
00118 void
00119 pl_linmod(register FILE *plotfp, register char *s)
00120 {
00121     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00122         putc( 'f', plotfp );
00123         while( *s )
00124                 putc( *s++, plotfp );
00125         putc( '\n', plotfp );
00126     } else {
00127         fprintf(plotfp, "f %s\n", s);
00128     }
00129 }
00130 
00131 void
00132 pl_move(register FILE *plotfp, int x, int y)
00133 {
00134     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00135         putc( 'm', plotfp );
00136         putsi( x );
00137         putsi( y );
00138     } else {
00139         fprintf(plotfp, "m %d %d\n", x, y);
00140     }
00141 }
00142 
00143 void
00144 pl_cont(register FILE *plotfp, int x, int y)
00145 {
00146     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00147         putc( 'n', plotfp );
00148         putsi( x );
00149         putsi( y );
00150     } else {
00151         fprintf(plotfp, "n %d %d\n", x, y);
00152     }
00153 }
00154 
00155 void
00156 pl_label(register FILE *plotfp, register char *s)
00157 {
00158     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00159         putc( 't', plotfp );
00160         while( *s )
00161                 putc( *s++, plotfp );
00162         putc( '\n', plotfp );
00163     } else {
00164         fprintf(plotfp, "t %s\n", s);
00165     }
00166 }
00167 
00168 void
00169 pl_space(register FILE *plotfp, int x1, int y1, int x2, int y2)
00170 {
00171     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00172         putc( 's', plotfp );
00173         putsi( x1 );
00174         putsi( y1 );
00175         putsi( x2 );
00176         putsi( y2 );
00177     } else {
00178         fprintf(plotfp, "s %d %d %d %d\n", x1, y1, x2, y2);
00179     }
00180 }
00181 
00182 void
00183 pl_erase(register FILE *plotfp)
00184 {
00185     if (pl_outputMode == PL_OUTPUT_MODE_BINARY)
00186         putc( 'e', plotfp );
00187     else
00188         fprintf(plotfp, "e\n");
00189 }
00190 
00191 void
00192 pl_circle(register FILE *plotfp, int x, int y, int r)
00193 {
00194     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00195         putc( 'c', plotfp );
00196         putsi( x );
00197         putsi( y );
00198         putsi( r );
00199     } else {
00200         fprintf(plotfp, "c %d %d %d\n", x, y, r);
00201     }
00202 }
00203 
00204 void
00205 pl_arc(register FILE *plotfp, int xc, int yc, int x1, int y1, int x2, int y2)
00206 {
00207     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00208         putc( 'a', plotfp );
00209         putsi( xc );
00210         putsi( yc );
00211         putsi( x1 );
00212         putsi( y1 );
00213         putsi( x2 );
00214         putsi( y2 );
00215     } else {
00216         fprintf(plotfp, "a %d %d %d %d %d %d\n", xc, yc, x1, y1, x2, y2);
00217     }
00218 }
00219 
00220 void
00221 pl_box(register FILE *plotfp, int x1, int y1, int x2, int y2)
00222 {
00223         pl_move( plotfp, x1, y1 );
00224         pl_cont( plotfp, x1, y2 );
00225         pl_cont( plotfp, x2, y2 );
00226         pl_cont( plotfp, x2, y1 );
00227         pl_cont( plotfp, x1, y1 );
00228         pl_move( plotfp, x2, y2 );
00229 }
00230 
00231 /*
00232  * Here lie the BRL 3-D extensions.
00233  */
00234 
00235 /* Warning: r, g, b are ints.  The output is chars. */
00236 void
00237 pl_color(register FILE *plotfp, int r, int g, int b)
00238 {
00239     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00240         putc( 'C', plotfp );
00241         putc( r, plotfp );
00242         putc( g, plotfp );
00243         putc( b, plotfp );
00244     } else {
00245         fprintf(plotfp, "C %d %d %d\n", r, g, b);
00246     }
00247 }
00248 
00249 void
00250 pl_flush(register FILE *plotfp)
00251 {
00252     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00253         putc( 'F', plotfp );
00254     } else {
00255         fprintf(plotfp, "F\n");
00256     }
00257 
00258     fflush( plotfp );
00259 }
00260 
00261 void
00262 pl_3space(register FILE *plotfp, int x1, int y1, int z1, int x2, int y2, int z2)
00263 {
00264     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00265         putc( 'S', plotfp );
00266         putsi( x1 );
00267         putsi( y1 );
00268         putsi( z1 );
00269         putsi( x2 );
00270         putsi( y2 );
00271         putsi( z2 );
00272     } else {
00273         fprintf(plotfp, "S %d %d %d %d %d %d\n", x1, y1, z1, x2, y2, z2);
00274     }
00275 }
00276 
00277 void
00278 pl_3point(register FILE *plotfp, int x, int y, int z)
00279 {
00280     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00281         putc( 'P', plotfp );
00282         putsi( x );
00283         putsi( y );
00284         putsi( z );
00285     } else {
00286         fprintf(plotfp, "P %d %d %d\n", x, y, z);
00287     }
00288 }
00289 
00290 void
00291 pl_3move(register FILE *plotfp, int x, int y, int z)
00292 {
00293     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00294         putc( 'M', plotfp );
00295         putsi( x );
00296         putsi( y );
00297         putsi( z );
00298     } else {
00299         fprintf(plotfp, "M %d %d %d\n", x, y, z);
00300     }
00301 }
00302 
00303 void
00304 pl_3cont(register FILE *plotfp, int x, int y, int z)
00305 {
00306     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00307         putc( 'N', plotfp );
00308         putsi( x );
00309         putsi( y );
00310         putsi( z );
00311     } else {
00312         fprintf(plotfp, "N %d %d %d\n", x, y, z);
00313     }
00314 }
00315 
00316 void
00317 pl_3line(register FILE *plotfp, int x1, int y1, int z1, int x2, int y2, int z2)
00318 {
00319     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00320         putc( 'L', plotfp );
00321         putsi( x1 );
00322         putsi( y1 );
00323         putsi( z1 );
00324         putsi( x2 );
00325         putsi( y2 );
00326         putsi( z2 );
00327     } else {
00328         fprintf(plotfp, "L %d %d %d %d %d %d\n", x1, y1, z1, x2, y2, z2);
00329     }
00330 }
00331 
00332 void
00333 pl_3box(register FILE *plotfp, int x1, int y1, int z1, int x2, int y2, int z2)
00334 {
00335         pl_3move( plotfp, x1, y1, z1 );
00336         /* first side */
00337         pl_3cont( plotfp, x1, y2, z1 );
00338         pl_3cont( plotfp, x1, y2, z2 );
00339         pl_3cont( plotfp, x1, y1, z2 );
00340         pl_3cont( plotfp, x1, y1, z1 );
00341         /* across */
00342         pl_3cont( plotfp, x2, y1, z1 );
00343         /* second side */
00344         pl_3cont( plotfp, x2, y2, z1 );
00345         pl_3cont( plotfp, x2, y2, z2 );
00346         pl_3cont( plotfp, x2, y1, z2 );
00347         pl_3cont( plotfp, x2, y1, z1 );
00348         /* front edge */
00349         pl_3move( plotfp, x1, y2, z1 );
00350         pl_3cont( plotfp, x2, y2, z1 );
00351         /* bottom back */
00352         pl_3move( plotfp, x1, y1, z2 );
00353         pl_3cont( plotfp, x2, y1, z2 );
00354         /* top back */
00355         pl_3move( plotfp, x1, y2, z2 );
00356         pl_3cont( plotfp, x2, y2, z2 );
00357 }
00358 
00359 /*
00360  * Double floating point versions
00361  */
00362 
00363 void
00364 pd_point(register FILE *plotfp, double x, double y)
00365 {
00366     double      in[2];
00367     unsigned char       out[2*8+1];
00368 
00369     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00370         in[0] = x;
00371         in[1] = y;
00372         htond( &out[1], (unsigned char *)in, 2 );
00373 
00374         out[0] = 'x';
00375         fwrite( out, 1, 2*8+1, plotfp );
00376     } else {
00377         fprintf(plotfp, "x %g %g\n", x, y);
00378     }
00379 }
00380 
00381 void
00382 pd_line(register FILE *plotfp, double x1, double y1, double x2, double y2)
00383 {
00384     double      in[4];
00385     unsigned char       out[4*8+1];
00386 
00387     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00388         in[0] = x1;
00389         in[1] = y1;
00390         in[2] = x2;
00391         in[3] = y2;
00392         htond( &out[1], (unsigned char *)in, 4 );
00393 
00394         out[0] = 'v';
00395         fwrite( out, 1, 4*8+1, plotfp );
00396     } else {
00397         fprintf(plotfp, "v %g %g %g %g\n", x1, y1, x2, y2);
00398     }
00399 }
00400 
00401 /* Note: no pd_linmod(), just use pl_linmod() */
00402 
00403 void
00404 pd_move(register FILE *plotfp, double x, double y)
00405 {
00406     double      in[2];
00407     unsigned char       out[2*8+1];
00408 
00409     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00410         in[0] = x;
00411         in[1] = y;
00412         htond( &out[1], (unsigned char *)in, 2 );
00413 
00414         out[0] = 'o';
00415         fwrite( out, 1, 2*8+1, plotfp );
00416     } else {
00417         fprintf(plotfp, "o %g %g\n", x, y);
00418     }
00419 }
00420 
00421 void
00422 pd_cont(register FILE *plotfp, double x, double y)
00423 {
00424     double      in[2];
00425     unsigned char       out[2*8+1];
00426 
00427     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00428         in[0] = x;
00429         in[1] = y;
00430         htond( &out[1], (unsigned char *)in, 2 );
00431 
00432         out[0] = 'q';
00433         fwrite( out, 1, 2*8+1, plotfp );
00434     } else {
00435         fprintf(plotfp, "q %g %g\n", x, y);
00436     }
00437 }
00438 
00439 void
00440 pd_space(register FILE *plotfp, double x1, double y1, double x2, double y2)
00441 {
00442     double      in[4];
00443     unsigned char       out[4*8+1];
00444 
00445     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00446         in[0] = x1;
00447         in[1] = y1;
00448         in[2] = x2;
00449         in[3] = y2;
00450         htond( &out[1], (unsigned char *)in, 4 );
00451 
00452         out[0] = 'w';
00453         fwrite( out, 1, 4*8+1, plotfp );
00454     } else {
00455         fprintf(plotfp, "w %g %g %g %g\n", x1, y1, x2, y2);
00456     }
00457 }
00458 
00459 void
00460 pd_circle(register FILE *plotfp, double x, double y, double r)
00461 {
00462     double      in[3];
00463     unsigned char       out[3*8+1];
00464 
00465     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00466         in[0] = x;
00467         in[1] = y;
00468         in[2] = r;
00469         htond( &out[1], (unsigned char *)in, 3 );
00470 
00471         out[0] = 'i';
00472         fwrite( out, 1, 3*8+1, plotfp );
00473     } else {
00474         fprintf(plotfp, "i %g %g %g\n", x, y, r);
00475     }
00476 }
00477 
00478 void
00479 pd_arc(register FILE *plotfp, double xc, double yc, double x1, double y1, double x2, double y2)
00480 {
00481     double      in[6];
00482     unsigned char       out[6*8+1];
00483 
00484     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00485         in[0] = xc;
00486         in[1] = yc;
00487         in[2] = x1;
00488         in[3] = y1;
00489         in[4] = x2;
00490         in[5] = y2;
00491         htond( &out[1], (unsigned char *)in, 6 );
00492 
00493         out[0] = 'r';
00494         fwrite( out, 1, 6*8+1, plotfp );
00495     } else {
00496         fprintf(plotfp, "r %g %g %g %g %g %g\n", xc, yc, x1, y1, x2, y2);
00497     }
00498 }
00499 
00500 void
00501 pd_box(register FILE *plotfp, double x1, double y1, double x2, double y2)
00502 {
00503         pd_move( plotfp, x1, y1 );
00504         pd_cont( plotfp, x1, y2 );
00505         pd_cont( plotfp, x2, y2 );
00506         pd_cont( plotfp, x2, y1 );
00507         pd_cont( plotfp, x1, y1 );
00508         pd_move( plotfp, x2, y2 );
00509 }
00510 
00511 /* Double 3-D, both in vector and enumerated versions */
00512 void
00513 pdv_3space(register FILE *plotfp, const fastf_t *min, const fastf_t *max)
00514 {
00515     unsigned char       out[6*8+1];
00516 
00517     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00518         htond( &out[1], (unsigned char *)min, 3 );
00519         htond( &out[3*8+1], (unsigned char *)max, 3 );
00520 
00521         out[0] = 'W';
00522         fwrite( out, 1, 6*8+1, plotfp );
00523     } else {
00524         fprintf(plotfp, "W %g %g %g %g %g %g\n", V3ARGS(min), V3ARGS(max));
00525     }
00526 }
00527 
00528 void
00529 pd_3space(register FILE *plotfp, double x1, double y1, double z1, double x2, double y2, double z2)
00530 {
00531     double      in[6];
00532     unsigned char       out[6*8+1];
00533 
00534     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00535         in[0] = x1;
00536         in[1] = y1;
00537         in[2] = z1;
00538         in[3] = x2;
00539         in[4] = y2;
00540         in[5] = z2;
00541         htond( &out[1], (unsigned char *)in, 6 );
00542 
00543         out[0] = 'W';
00544         fwrite( out, 1, 6*8+1, plotfp );
00545     } else {
00546         fprintf(plotfp, "W %g %g %g %g %g %g\n", x1, y1, z1, x2, y2, z2);
00547     }
00548 }
00549 
00550 void
00551 pdv_3point(register FILE *plotfp, const fastf_t *pt)
00552 {
00553     unsigned char       out[3*8+1];
00554 
00555     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00556         htond( &out[1], (unsigned char *)pt, 3 );
00557 
00558         out[0] = 'X';
00559         fwrite( out, 1, 3*8+1, plotfp );
00560     } else {
00561         fprintf(plotfp, "X %g %g %g\n", V3ARGS(pt));
00562     }
00563 }
00564 
00565 void
00566 pd_3point(register FILE *plotfp, double x, double y, double z)
00567 {
00568     double      in[3];
00569     unsigned char       out[3*8+1];
00570 
00571     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00572         in[0] = x;
00573         in[1] = y;
00574         in[2] = z;
00575         htond( &out[1], (unsigned char *)in, 3 );
00576 
00577         out[0] = 'X';
00578         fwrite( out, 1, 3*8+1, plotfp );
00579     } else {
00580         fprintf(plotfp, "X %g %g %g\n", x, y, z);
00581     }
00582 }
00583 
00584 void
00585 pdv_3move(register FILE *plotfp, const fastf_t *pt)
00586 {
00587     unsigned char       out[3*8+1];
00588 
00589     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00590         htond( &out[1], (unsigned char *)pt, 3 );
00591 
00592         out[0] = 'O';
00593         fwrite( out, 1, 3*8+1, plotfp );
00594     } else {
00595         fprintf(plotfp, "O %g %g %g\n", V3ARGS(pt));
00596     }
00597 }
00598 
00599 void
00600 pd_3move(register FILE *plotfp, double x, double y, double z)
00601 {
00602     double      in[3];
00603     unsigned char       out[3*8+1];
00604 
00605     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00606         in[0] = x;
00607         in[1] = y;
00608         in[2] = z;
00609         htond( &out[1], (unsigned char *)in, 3 );
00610 
00611         out[0] = 'O';
00612         fwrite( out, 1, 3*8+1, plotfp );
00613     } else {
00614         fprintf(plotfp, "O %g %g %g\n", x, y, z);
00615     }
00616 }
00617 
00618 void
00619 pdv_3cont(register FILE *plotfp, const fastf_t *pt)
00620 {
00621     unsigned char       out[3*8+1];
00622 
00623     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00624         htond( &out[1], (unsigned char *)pt, 3 );
00625 
00626         out[0] = 'Q';
00627         fwrite( out, 1, 3*8+1, plotfp );
00628     } else {
00629         fprintf(plotfp, "Q %g %g %g\n", V3ARGS(pt));
00630     }
00631 }
00632 
00633 void
00634 pd_3cont(register FILE *plotfp, double x, double y, double z)
00635 {
00636     double      in[3];
00637     unsigned char       out[3*8+1];
00638 
00639     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00640         in[0] = x;
00641         in[1] = y;
00642         in[2] = z;
00643         htond( &out[1], (unsigned char *)in, 3 );
00644 
00645         out[0] = 'Q';
00646         fwrite( out, 1, 3*8+1, plotfp );
00647     } else {
00648         fprintf(plotfp, "Q %g %g %g\n", x, y, z);
00649     }
00650 }
00651 
00652 void
00653 pdv_3line(register FILE *plotfp, const fastf_t *a, const fastf_t *b)
00654 {
00655     unsigned char       out[6*8+1];
00656 
00657     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00658         htond( &out[1], (unsigned char *)a, 3 );
00659         htond( &out[3*8+1], (unsigned char *)b, 3 );
00660 
00661         out[0] = 'V';
00662         fwrite( out, 1, 6*8+1, plotfp );
00663     } else {
00664         fprintf(plotfp, "V %g %g %g %g %g %g\n", V3ARGS(a), V3ARGS(b));
00665     }
00666 }
00667 
00668 void
00669 pd_3line(register FILE *plotfp, double x1, double y1, double z1, double x2, double y2, double z2)
00670 {
00671     double      in[6];
00672     unsigned char       out[6*8+1];
00673 
00674     if (pl_outputMode == PL_OUTPUT_MODE_BINARY) {
00675         in[0] = x1;
00676         in[1] = y1;
00677         in[2] = z1;
00678         in[3] = x2;
00679         in[4] = y2;
00680         in[5] = z2;
00681         htond( &out[1], (unsigned char *)in, 6 );
00682 
00683         out[0] = 'V';
00684         fwrite( out, 1, 6*8+1, plotfp );
00685     } else {
00686         fprintf(plotfp, "V %g %g %g %g %g %g\n", x1, y1, z1, x2, y2, z2);
00687     }
00688 }
00689 
00690 void
00691 pdv_3box(register FILE *plotfp, const fastf_t *a, const fastf_t *b)
00692 {
00693         pd_3move( plotfp, a[X], a[Y], a[Z] );
00694         /* first side */
00695         pd_3cont( plotfp, a[X], b[Y], a[Z] );
00696         pd_3cont( plotfp, a[X], b[Y], b[Z] );
00697         pd_3cont( plotfp, a[X], a[Y], b[Z] );
00698         pd_3cont( plotfp, a[X], a[Y], a[Z] );
00699         /* across */
00700         pd_3cont( plotfp, b[X], a[Y], a[Z] );
00701         /* second side */
00702         pd_3cont( plotfp, b[X], b[Y], a[Z] );
00703         pd_3cont( plotfp, b[X], b[Y], b[Z] );
00704         pd_3cont( plotfp, b[X], a[Y], b[Z] );
00705         pd_3cont( plotfp, b[X], a[Y], a[Z] );
00706         /* front edge */
00707         pd_3move( plotfp, a[X], b[Y], a[Z] );
00708         pd_3cont( plotfp, b[X], b[Y], a[Z] );
00709         /* bottom back */
00710         pd_3move( plotfp, a[X], a[Y], b[Z] );
00711         pd_3cont( plotfp, b[X], a[Y], b[Z] );
00712         /* top back */
00713         pd_3move( plotfp, a[X], b[Y], b[Z] );
00714         pd_3cont( plotfp, b[X], b[Y], b[Z] );
00715 }
00716 
00717 void
00718 pd_3box(register FILE *plotfp, double x1, double y1, double z1, double x2, double y2, double z2)
00719 {
00720         pd_3move( plotfp, x1, y1, z1 );
00721         /* first side */
00722         pd_3cont( plotfp, x1, y2, z1 );
00723         pd_3cont( plotfp, x1, y2, z2 );
00724         pd_3cont( plotfp, x1, y1, z2 );
00725         pd_3cont( plotfp, x1, y1, z1 );
00726         /* across */
00727         pd_3cont( plotfp, x2, y1, z1 );
00728         /* second side */
00729         pd_3cont( plotfp, x2, y2, z1 );
00730         pd_3cont( plotfp, x2, y2, z2 );
00731         pd_3cont( plotfp, x2, y1, z2 );
00732         pd_3cont( plotfp, x2, y1, z1 );
00733         /* front edge */
00734         pd_3move( plotfp, x1, y2, z1 );
00735         pd_3cont( plotfp, x2, y2, z1 );
00736         /* bottom back */
00737         pd_3move( plotfp, x1, y1, z2 );
00738         pd_3cont( plotfp, x2, y1, z2 );
00739         /* top back */
00740         pd_3move( plotfp, x1, y2, z2 );
00741         pd_3cont( plotfp, x2, y2, z2 );
00742 }
00743 
00744 /**
00745  *  Draw a ray
00746  */
00747 void
00748 pdv_3ray(FILE *fp, const fastf_t *pt, const fastf_t *dir, double t)
00749 {
00750         point_t tip;
00751 
00752         VJOIN1( tip, pt, t, dir );
00753         pdv_3move( fp, pt );
00754         pdv_3cont( fp, tip );
00755 }
00756 
00757 /*@}*/
00758 /*
00759  * Local Variables:
00760  * mode: C
00761  * tab-width: 8
00762  * c-basic-offset: 4
00763  * indent-tabs-mode: t
00764  * End:
00765  * ex: shiftwidth=4 tabstop=8
00766  */

Generated on Mon Sep 18 01:24:47 2006 for BRL-CAD by  doxygen 1.4.6