plot3.h

Go to the documentation of this file.
00001 /*                         P L O T 3 . H
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.1 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 /** @addtogroup plot */
00022 /*@{*/
00023 /** @file plot3.h
00024  *
00025  *
00026  * This is a ANSI C header for LIBPLOT3 giving function prototypes.
00027  * This header file will also work if called by a "traditional" C
00028  * compiler.
00029  *
00030  *  For best results, before the 
00031 @code
00032      #include "plot3.h"
00033 @endcode
00034  * there should be:
00035  *
00036 @code
00037         #include "machine.h"
00038         #include "vmath.h"
00039 @endcode
00040  *
00041  *  although not doing this should not be fatal.
00042  *
00043  *      $Header: /cvsroot/brlcad/brlcad/include/plot3.h,v 14.8 2006/09/18 05:24:07 lbutler Exp $
00044  */
00045 #ifndef PLOT3_H
00046 #define PLOT3_H
00047 
00048 #include "bu.h"
00049 #include "vmath.h"
00050 #include "bn.h"
00051 
00052 #define pl_mat_idn( _mat )              MAT_IDN( _mat )
00053 #define pl_mat_zero( _mat )             MAT_ZERO( _mat )
00054 #define pl_mat_copy( _mat1, _mat2 )     MAT_COPY( _mat1, _mat2 )
00055 
00056 #define PL_OUTPUT_MODE_BINARY 0
00057 #define PL_OUTPUT_MODE_TEXT 1
00058 
00059 /*
00060  *  The basic UNIX-plot routines.
00061  *  The calling sequence is the same as the original Bell Labs routines,
00062  *  with the exception of the pl_ prefix on the name.
00063  */
00064 BN_EXPORT BU_EXTERN(int pl_getOutputMode,
00065                     ());
00066 BN_EXPORT BU_EXTERN(void pl_setOutputMode,
00067                     (int mode));
00068 BN_EXPORT BU_EXTERN(void pl_point,
00069                     (FILE *plotfp,
00070                      int x,
00071                      int y));
00072 BN_EXPORT BU_EXTERN(void pl_line,
00073                     (FILE *plotfp,
00074                      int fx,
00075                      int fy,
00076                      int tx,
00077                      int ty));
00078 BN_EXPORT BU_EXTERN(void pl_linmod,
00079                     (FILE *plotfp,
00080                      char *s));
00081 BN_EXPORT BU_EXTERN(void pl_move,
00082                     (FILE *plotfp,
00083                      int x,
00084                      int y));
00085 BN_EXPORT BU_EXTERN(void pl_cont,
00086                     (FILE *plotfp,
00087                      int x,
00088                      int y));
00089 BN_EXPORT BU_EXTERN(void pl_label,
00090                     (FILE *plotfp,
00091                      char *s));
00092 BN_EXPORT BU_EXTERN(void pl_space,
00093                     (FILE *plotfp,
00094                      int x1,
00095                      int y1,
00096                      int x2,
00097                      int y2));
00098 BN_EXPORT BU_EXTERN(void pl_erase,
00099                     (FILE *plotfp));
00100 BN_EXPORT BU_EXTERN(void pl_circle,
00101                     (FILE *plotfp,
00102                      int x,
00103                      int y,
00104                      int r));
00105 BN_EXPORT BU_EXTERN(void pl_arc,
00106                     (FILE *plotfp,
00107                      int xc,
00108                      int yc,
00109                      int x1,
00110                      int y1,
00111                      int x2,
00112                      int y2));
00113 BN_EXPORT BU_EXTERN(void pl_box,
00114                     (FILE *plotfp,
00115                      int x1,
00116                      int y1,
00117                      int x2,
00118                      int y2));
00119 
00120 /*
00121  * BRL extensions to the UNIX-plot file format.
00122  */
00123 BN_EXPORT BU_EXTERN(void pl_color,
00124                     (FILE *plotfp,
00125                      int r,
00126                      int g,
00127                      int b));
00128 BN_EXPORT BU_EXTERN(void pl_flush,
00129                     (FILE *plotfp));
00130 BN_EXPORT BU_EXTERN(void pl_3space,
00131                     (FILE *plotfp,
00132                      int x1,
00133                      int y1,
00134                      int z1,
00135                      int x2,
00136                      int y2,
00137                      int z2));
00138 BN_EXPORT BU_EXTERN(void pl_3point,
00139                     (FILE *plotfp,
00140                      int x,
00141                      int y,
00142                      int z));
00143 BN_EXPORT BU_EXTERN(void pl_3move,
00144                     (FILE *plotfp,
00145                      int x,
00146                      int y,
00147                      int z));
00148 BN_EXPORT BU_EXTERN(void pl_3cont,
00149                     (FILE *plotfp,
00150                      int x,
00151                      int y,
00152                      int z));
00153 BN_EXPORT BU_EXTERN(void pl_3line,
00154                     (FILE *plotfp,
00155                      int x1,
00156                      int y1,
00157                      int z1,
00158                      int x2,
00159                      int y2,
00160                      int z2));
00161 BN_EXPORT BU_EXTERN(void pl_3box,
00162                     (FILE *plotfp,
00163                      int x1,
00164                      int y1,
00165                      int z1,
00166                      int x2,
00167                      int y2,
00168                      int z2));
00169 
00170 /* Double floating point versions */
00171 BN_EXPORT BU_EXTERN(void pd_point,
00172                     (FILE *plotfp,
00173                      double x,
00174                      double y));
00175 BN_EXPORT BU_EXTERN(void pd_line,
00176                     (FILE *plotfp,
00177                      double fx,
00178                      double fy,
00179                      double tx,
00180                      double ty));
00181 BN_EXPORT BU_EXTERN(void pd_move,
00182                     (FILE *plotfp,
00183                      double x,
00184                      double y));
00185 BN_EXPORT BU_EXTERN(void pd_cont,
00186                     (FILE *plotfp,
00187                      double x,
00188                      double y));
00189 BN_EXPORT BU_EXTERN(void pd_space,
00190                     (FILE *plotfp,
00191                      double x1,
00192                      double y1,
00193                      double x2,
00194                      double y2));
00195 BN_EXPORT BU_EXTERN(void pd_circle,
00196                     (FILE *plotfp,
00197                      double x,
00198                      double y,
00199                      double r));
00200 BN_EXPORT BU_EXTERN(void pd_arc,
00201                     (FILE *plotfp,
00202                      double xc,
00203                      double yc,
00204                      double x1,
00205                      double y1,
00206                      double x2,
00207                      double y2));
00208 BN_EXPORT BU_EXTERN(void pd_box,
00209                     (FILE *plotfp,
00210                      double x1,
00211                      double y1,
00212                      double x2,
00213                      double y2));
00214 
00215 /* Double 3-D both in vector and enumerated versions */
00216 #ifdef VMATH_H
00217 BN_EXPORT BU_EXTERN(void pdv_3space,
00218                     (FILE *plotfp,
00219                      const vect_t min,
00220                      const vect_t max));
00221 BN_EXPORT BU_EXTERN(void pdv_3point,
00222                     (FILE *plotfp,
00223                      const vect_t pt));
00224 BN_EXPORT BU_EXTERN(void pdv_3move,
00225                     (FILE *plotfp,
00226                      const vect_t pt));
00227 BN_EXPORT BU_EXTERN(void pdv_3cont,
00228                     (FILE *plotfp,
00229                      const vect_t pt));
00230 BN_EXPORT BU_EXTERN(void pdv_3line,
00231                     (FILE *plotfp,
00232                      const vect_t a,
00233                      const vect_t b));
00234 BN_EXPORT BU_EXTERN(void pdv_3box,
00235                     (FILE *plotfp,
00236                      const vect_t a,
00237                      const vect_t b));
00238 #endif /* VMATH_H */
00239 BN_EXPORT BU_EXTERN(void pd_3space,
00240                     (FILE *plotfp,
00241                      double x1,
00242                      double y1,
00243                      double z1,
00244                      double x2,
00245                      double y2,
00246                      double z2));
00247 BN_EXPORT BU_EXTERN(void pd_3point,
00248                     (FILE *plotfp,
00249                      double x,
00250                      double y,
00251                      double z));
00252 BN_EXPORT BU_EXTERN(void pd_3move,
00253                     (FILE *plotfp,
00254                      double x,
00255                      double y,
00256                      double z));
00257 BN_EXPORT BU_EXTERN(void pd_3cont,
00258                     (FILE *plotfp,
00259                      double x,
00260                      double y,
00261                      double z));
00262 BN_EXPORT BU_EXTERN(void pd_3line,
00263                     (FILE *plotfp,
00264                      double x1,
00265                      double y1,
00266                      double z1,
00267                      double x2,
00268                      double y2,
00269                      double z2));
00270 BN_EXPORT BU_EXTERN(void pd_3box,
00271                     (FILE *plotfp,
00272                      double x1,
00273                      double y1,
00274                      double z1,
00275                      double x2,
00276                      double y2,
00277                      double z2));
00278 BN_EXPORT BU_EXTERN(void pdv_3ray,
00279                     (FILE *fp,
00280                      const point_t pt,
00281                      const vect_t dir,
00282                      double t));
00283 
00284 /*
00285  *  The following routines are taken from the BRL TIG-PACK
00286  *  (Terminal Independent Plotting Package).
00287  *  These routines create plots by using the pl_() and pd_() routines
00288  *  declared above.
00289  */
00290 
00291 #define PL_FORTRAN(lc,uc)       BU_FORTRAN(lc,uc)
00292 
00293 BN_EXPORT BU_EXTERN(void tp_i2list,
00294                     (FILE *fp,
00295                      int *x,
00296                      int *y,
00297                      int npoints));
00298 BN_EXPORT BU_EXTERN(void tp_2list,
00299                     (FILE *fp,
00300                      double *x,
00301                      double *y,
00302                      int npoints));
00303 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f2list, F2LIST),
00304                     (FILE **fpp,
00305                      float *x,
00306                      float *y,
00307                      int *n));
00308 BN_EXPORT BU_EXTERN(void tp_3list,
00309                     (FILE *fp,
00310                      double *x,
00311                      double *y,
00312                      double *z,
00313                      int npoints));
00314 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f3list, F3LIST),
00315                     (FILE **fpp,
00316                      float *x,
00317                      float *y,
00318                      float *z,
00319                      int *n));
00320 BN_EXPORT BU_EXTERN(void tp_2mlist,
00321                     (FILE *fp,
00322                      double *x,
00323                      double *y,
00324                      int npoints,
00325                      int flag,
00326                      int mark,
00327                      int interval,
00328                      double size));
00329 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f2mlst, F2MLST),
00330                     (FILE **fp,
00331                      float *x,
00332                      float *y,
00333                      int *np,
00334                      int *flag,
00335                      int *mark,
00336                      int *interval,
00337                      float *size));
00338 BN_EXPORT BU_EXTERN(void tp_2marker,
00339                     (FILE *fp,
00340                      int c,
00341                      double x,
00342                      double y,
00343                      double scale));
00344 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f2mark, F2MARK),
00345                     (FILE **fp,
00346                      int *c,
00347                      float *x,
00348                      float *y,
00349                      float *scale));
00350 BN_EXPORT BU_EXTERN(void tp_3marker,
00351                     (FILE *fp,
00352                      int c,
00353                      double x,
00354                      double y,
00355                      double z,
00356                      double scale));
00357 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f3mark, F3MARK),
00358                     (FILE **fp,
00359                      int *c,
00360                      float *x,
00361                      float *y,
00362                      float *z,
00363                      float *scale));
00364 BN_EXPORT BU_EXTERN(void tp_2number,
00365                     (FILE *fp,
00366                      double input,
00367                      int x,
00368                      int y,
00369                      int cscale,
00370                      double theta,
00371                      int digits));
00372 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f2numb, F2NUMB),
00373                     (FILE **fp,
00374                      float *input,
00375                      int *x,
00376                      int *y,
00377                      float *cscale,
00378                      float *theta,
00379                      int *digits));
00380 BN_EXPORT BU_EXTERN(void tp_scale,
00381                     (int idata[],
00382                      int elements,
00383                      int mode,
00384                      int length,
00385                      int odata[],
00386                      double *min,
00387                      double *dx));
00388 
00389 BN_EXPORT BU_EXTERN(void BU_FORTRAN(fscale, FSCALE),
00390                     (int idata[],
00391                      int *elements,
00392                      char *mode,
00393                      int *length,
00394                      int odata[],
00395                      double *min,
00396                      double *dx));
00397 BN_EXPORT BU_EXTERN(void tp_2symbol,
00398                     (FILE *fp,
00399                      char *string,
00400                      double x,
00401                      double y,
00402                      double scale,
00403                      double theta));
00404 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f2symb, F2SYMB),
00405                     (FILE **fp,
00406                      char *string,
00407                      float *x,
00408                      float *y,
00409                      float *scale,
00410                      float *theta));
00411 BN_EXPORT BU_EXTERN(void tp_plot,
00412                     (FILE *fp,
00413                      int xp,
00414                      int yp,
00415                      int xl,
00416                      int yl,
00417                      char xtitle[],
00418                      char ytitle[],
00419                      float x[],
00420                      float y[],
00421                      int n,
00422                      double cscale));
00423 BN_EXPORT BU_EXTERN(void BU_FORTRAN(fplot, FPLOT),
00424                     (FILE **fp,
00425                      int *xp,
00426                      int *yp,
00427                      int *xl,
00428                      int *yl,
00429                      char *xtitle,
00430                      char *ytitle,
00431                      float *x,
00432                      float *y,
00433                      int *n,
00434                      float *cscale));
00435 BN_EXPORT BU_EXTERN(void tp_ftoa,
00436                     (float x, char *s));
00437 BN_EXPORT BU_EXTERN(void tp_fixsc,
00438                     (float *x,
00439                      int npts,
00440                      float size,
00441                      float *xs,
00442                      float *xmin,
00443                      float *xmax,
00444                      float *dx));
00445 BN_EXPORT BU_EXTERN(void tp_sep,
00446                     (float x,
00447                      float *coef,
00448                      int *ex));
00449 BN_EXPORT BU_EXTERN(double tp_ipow,
00450                     (double x,
00451                      int n));
00452 #ifdef VMATH_H
00453 BN_EXPORT BU_EXTERN(void tp_3axis,
00454                     (FILE *fp,
00455                      char *string,
00456                      point_t origin,
00457                      mat_t rot,
00458                      double length,
00459                      int ccw,
00460                      int ndigits,
00461                      double label_start,
00462                      double label_incr,
00463                      double tick_separation,
00464                      double char_width));
00465 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f3axis, F3AXIS),
00466                     (FILE **fp,
00467                      char *string,
00468                      float *x,
00469                      float *y,
00470                      float *z,
00471                      float *length,
00472                      float *theta,
00473                      int *ccw,
00474                      int *ndigits,
00475                      float *label_start,
00476                      float *label_incr,
00477                      float *tick_separation,
00478                      float *char_width));
00479 BN_EXPORT BU_EXTERN(void tp_3symbol,
00480                     (FILE *fp,
00481                      char *string,
00482                      point_t origin,
00483                      mat_t rot,
00484                      double scale));
00485 BN_EXPORT BU_EXTERN(void tp_3vector,
00486                     (FILE *plotfp,
00487                      point_t from,
00488                      point_t to,
00489                      double fromheadfract,
00490                      double toheadfract));
00491 BN_EXPORT BU_EXTERN(void BU_FORTRAN(f3vect, F3VECT),
00492                     (FILE **fp,
00493                      float *fx,
00494                      float *fy,
00495                      float *fz,
00496                      float *tx,
00497                      float *ty,
00498                      float *tz,
00499                      float *fl,
00500                      float *tl));
00501 #endif /* VMATH_H */
00502 
00503 #endif /* PLOT3_H */
00504 /*@}*/
00505 /*
00506  * Local Variables:
00507  * mode: C
00508  * tab-width: 8
00509  * c-basic-offset: 4
00510  * indent-tabs-mode: t
00511  * End:
00512  * ex: shiftwidth=4 tabstop=8
00513  */
00514 

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