plot3.h

Go to the documentation of this file.
00001 /*                         P L O T 3 . H
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 2004-2012 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  * version 2.1 as published by the Free Software Foundation.
00010  *
00011  * This library is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this file; see the file named COPYING for more
00018  * information.
00019  */
00020 /** @addtogroup plot */
00021 /** @{ */
00022 /** @file plot3.h
00023  *
00024  * This is a ANSI C header for LIBPLOT3 giving function prototypes.
00025  * This header file will also work if called by a "traditional" C
00026  * compiler.
00027  *
00028  */
00029 #ifndef PLOT3_H
00030 #define PLOT3_H
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 #include "common.h"
00037 
00038 #include "bu.h"
00039 #include "vmath.h"
00040 #include "bn.h"
00041 
00042 #define pl_mat_idn( _mat )              MAT_IDN( _mat )
00043 #define pl_mat_zero( _mat )             MAT_ZERO( _mat )
00044 #define pl_mat_copy( _mat1, _mat2 )     MAT_COPY( _mat1, _mat2 )
00045 
00046 #define PL_OUTPUT_MODE_BINARY 0
00047 #define PL_OUTPUT_MODE_TEXT 1
00048 
00049 /*
00050  *  The basic UNIX-plot routines.
00051  *  The calling sequence is the same as the original Bell Labs routines,
00052  *  with the exception of the pl_ prefix on the name.
00053  */
00054 BN_EXPORT extern int pl_getOutputMode();
00055 BN_EXPORT extern void pl_setOutputMode(int mode);
00056 BN_EXPORT extern void pl_point(FILE *plotfp,
00057                      int x,
00058                      int y);
00059 BN_EXPORT extern void pl_line(FILE *plotfp,
00060                      int fx,
00061                      int fy,
00062                      int tx,
00063                      int ty);
00064 BN_EXPORT extern void pl_linmod(FILE *plotfp,
00065                      char *s);
00066 BN_EXPORT extern void pl_move(FILE *plotfp,
00067                      int x,
00068                      int y);
00069 BN_EXPORT extern void pl_cont(FILE *plotfp,
00070                      int x,
00071                      int y);
00072 BN_EXPORT extern void pl_label(FILE *plotfp,
00073                      char *s);
00074 BN_EXPORT extern void pl_space(FILE *plotfp,
00075                      int x_1,
00076                      int y_1,
00077                      int x_2,
00078                      int y_2);
00079 BN_EXPORT extern void pl_erase(FILE *plotfp);
00080 BN_EXPORT extern void pl_circle(FILE *plotfp,
00081                      int x,
00082                      int y,
00083                      int r);
00084 BN_EXPORT extern void pl_arc(FILE *plotfp,
00085                      int xc,
00086                      int yc,
00087                      int x_1,
00088                      int y_1,
00089                      int x_2,
00090                      int y_2);
00091 BN_EXPORT extern void pl_box(FILE *plotfp,
00092                      int x_1,
00093                      int y_1,
00094                      int x_2,
00095                      int y_2);
00096 
00097 /*
00098  * BRL extensions to the UNIX-plot file format.
00099  */
00100 BN_EXPORT extern void pl_color(FILE *plotfp,
00101                      int r,
00102                      int g,
00103                      int b);
00104 BN_EXPORT extern void pl_flush(FILE *plotfp);
00105 BN_EXPORT extern void pl_3space(FILE *plotfp,
00106                      int x_1,
00107                      int y_1,
00108                      int z_1,
00109                      int x_2,
00110                      int y_2,
00111                      int z_2);
00112 BN_EXPORT extern void pl_3point(FILE *plotfp,
00113                      int x,
00114                      int y,
00115                      int z);
00116 BN_EXPORT extern void pl_3move(FILE *plotfp,
00117                      int x,
00118                      int y,
00119                      int z);
00120 BN_EXPORT extern void pl_3cont(FILE *plotfp,
00121                      int x,
00122                      int y,
00123                      int z);
00124 BN_EXPORT extern void pl_3line(FILE *plotfp,
00125                      int x_1,
00126                      int y_1,
00127                      int z_1,
00128                      int x_2,
00129                      int y_2,
00130                      int z_2);
00131 BN_EXPORT extern void pl_3box(FILE *plotfp,
00132                      int x_1,
00133                      int y_1,
00134                      int z_1,
00135                      int x_2,
00136                      int y_2,
00137                      int z_2);
00138 
00139 /* Double floating point versions */
00140 BN_EXPORT extern void pd_point(FILE *plotfp,
00141                      double x,
00142                      double y);
00143 BN_EXPORT extern void pd_line(FILE *plotfp,
00144                      double fx,
00145                      double fy,
00146                      double tx,
00147                      double ty);
00148 BN_EXPORT extern void pd_move(FILE *plotfp,
00149                      double x,
00150                      double y);
00151 BN_EXPORT extern void pd_cont(FILE *plotfp,
00152                      double x,
00153                      double y);
00154 BN_EXPORT extern void pd_space(FILE *plotfp,
00155                      double x_1,
00156                      double y_1,
00157                      double x_2,
00158                      double y_2);
00159 BN_EXPORT extern void pd_circle(FILE *plotfp,
00160                      double x,
00161                      double y,
00162                      double r);
00163 BN_EXPORT extern void pd_arc(FILE *plotfp,
00164                      double xc,
00165                      double yc,
00166                      double x_1,
00167                      double y_1,
00168                      double x_2,
00169                      double y_2);
00170 BN_EXPORT extern void pd_box(FILE *plotfp,
00171                      double x_1,
00172                      double y_1,
00173                      double x_2,
00174                      double y_2);
00175 
00176 /* Double 3-D both in vector and enumerated versions */
00177 #ifdef __VMATH_H__
00178 BN_EXPORT extern void pdv_3space(FILE *plotfp,
00179                      const vect_t min,
00180                      const vect_t max);
00181 BN_EXPORT extern void pdv_3point(FILE *plotfp,
00182                      const vect_t pt);
00183 BN_EXPORT extern void pdv_3move(FILE *plotfp,
00184                      const vect_t pt);
00185 BN_EXPORT extern void pdv_3cont(FILE *plotfp,
00186                      const vect_t pt);
00187 BN_EXPORT extern void pdv_3line(FILE *plotfp,
00188                      const vect_t a,
00189                      const vect_t b);
00190 BN_EXPORT extern void pdv_3box(FILE *plotfp,
00191                      const vect_t a,
00192                      const vect_t b);
00193 #endif /* __VMATH_H__ */
00194 BN_EXPORT extern void pd_3space(FILE *plotfp,
00195                      double x_1,
00196                      double y_1,
00197                      double z_1,
00198                      double x_2,
00199                      double y_2,
00200                      double z_2);
00201 BN_EXPORT extern void pd_3point(FILE *plotfp,
00202                      double x,
00203                      double y,
00204                      double z);
00205 BN_EXPORT extern void pd_3move(FILE *plotfp,
00206                      double x,
00207                      double y,
00208                      double z);
00209 BN_EXPORT extern void pd_3cont(FILE *plotfp,
00210                      double x,
00211                      double y,
00212                      double z);
00213 BN_EXPORT extern void pd_3line(FILE *plotfp,
00214                      double x_1,
00215                      double y_1,
00216                      double z_1,
00217                      double x_2,
00218                      double y_2,
00219                      double z_2);
00220 BN_EXPORT extern void pd_3box(FILE *plotfp,
00221                      double x_1,
00222                      double y_1,
00223                      double z_1,
00224                      double x_2,
00225                      double y_2,
00226                      double z_2);
00227 BN_EXPORT extern void pdv_3ray(FILE *fp,
00228                      const point_t pt,
00229                      const vect_t dir,
00230                      double t);
00231 
00232 /*
00233  *  The following routines are taken from the BRL TIG-PACK
00234  *  (Terminal Independent Plotting Package).
00235  *  These routines create plots by using the pl_() and pd_() routines
00236  *  declared above.
00237  */
00238 
00239 #define PL_FORTRAN(lc, uc)      BU_FORTRAN(lc, uc)
00240 
00241 BN_EXPORT extern void tp_i2list(FILE *fp,
00242                      int *x,
00243                      int *y,
00244                      int npoints);
00245 BN_EXPORT extern void tp_2list(FILE *fp,
00246                      double *x,
00247                      double *y,
00248                      int npoints);
00249 BN_EXPORT extern void BU_FORTRAN(f2list, F2LIST)(FILE **fpp,
00250                      float *x,
00251                      float *y,
00252                      int *n);
00253 BN_EXPORT extern void tp_3list(FILE *fp,
00254                      double *x,
00255                      double *y,
00256                      double *z,
00257                      int npoints);
00258 BN_EXPORT extern void BU_FORTRAN(f3list, F3LIST)(FILE **fpp,
00259                      float *x,
00260                      float *y,
00261                      float *z,
00262                      int *n);
00263 BN_EXPORT extern void tp_2mlist(FILE *fp,
00264                      double *x,
00265                      double *y,
00266                      int npoints,
00267                      int flag,
00268                      int mark,
00269                      int interval,
00270                      double size);
00271 BN_EXPORT extern void BU_FORTRAN(f2mlst, F2MLST)(FILE **fp,
00272                      float *x,
00273                      float *y,
00274                      int *np,
00275                      int *flag,
00276                      int *mark,
00277                      int *interval,
00278                      float *size);
00279 BN_EXPORT extern void tp_2marker(FILE *fp,
00280                      int c,
00281                      double x,
00282                      double y,
00283                      double scale);
00284 BN_EXPORT extern void BU_FORTRAN(f2mark, F2MARK)(FILE **fp,
00285                      int *c,
00286                      float *x,
00287                      float *y,
00288                      float *scale);
00289 BN_EXPORT extern void tp_3marker(FILE *fp,
00290                      int c,
00291                      double x,
00292                      double y,
00293                      double z,
00294                      double scale);
00295 BN_EXPORT extern void BU_FORTRAN(f3mark, F3MARK)(FILE **fp,
00296                      int *c,
00297                      float *x,
00298                      float *y,
00299                      float *z,
00300                      float *scale);
00301 BN_EXPORT extern void tp_2number(FILE *fp,
00302                      double input,
00303                      int x,
00304                      int y,
00305                      int cscale,
00306                      double theta,
00307                      int digits);
00308 BN_EXPORT extern void BU_FORTRAN(f2numb, F2NUMB)(FILE **fp,
00309                      float *input,
00310                      int *x,
00311                      int *y,
00312                      float *cscale,
00313                      float *theta,
00314                      int *digits);
00315 BN_EXPORT extern void tp_scale(int idata[],
00316                      int elements,
00317                      int mode,
00318                      int length,
00319                      int odata[],
00320                      double *min,
00321                      double *dx);
00322 
00323 BN_EXPORT extern void BU_FORTRAN(fscale, FSCALE)(int idata[],
00324                      int *elements,
00325                      char *mode,
00326                      int *length,
00327                      int odata[],
00328                      double *min,
00329                      double *dx);
00330 BN_EXPORT extern void tp_2symbol(FILE *fp,
00331                      char *string,
00332                      double x,
00333                      double y,
00334                      double scale,
00335                      double theta);
00336 BN_EXPORT extern void BU_FORTRAN(f2symb, F2SYMB)(FILE **fp,
00337                      char *string,
00338                      float *x,
00339                      float *y,
00340                      float *scale,
00341                      float *theta);
00342 BN_EXPORT extern void tp_plot(FILE *fp,
00343                      int xp,
00344                      int yp,
00345                      int xl,
00346                      int yl,
00347                      char xtitle[],
00348                      char ytitle[],
00349                      float x[],
00350                      float y[],
00351                      int n,
00352                      double cscale);
00353 BN_EXPORT extern void BU_FORTRAN(fplot, FPLOT)(FILE **fp,
00354                      int *xp,
00355                      int *yp,
00356                      int *xl,
00357                      int *yl,
00358                      char *xtitle,
00359                      char *ytitle,
00360                      float *x,
00361                      float *y,
00362                      int *n,
00363                      float *cscale);
00364 BN_EXPORT extern void tp_ftoa(float x, char *s);
00365 BN_EXPORT extern void tp_fixsc(float *x,
00366                      int npts,
00367                      float size,
00368                      float *xs,
00369                      float *xmin,
00370                      float *xmax,
00371                      float *dx);
00372 BN_EXPORT extern void tp_sep(float x,
00373                      float *coef,
00374                      int *ex);
00375 BN_EXPORT extern double tp_ipow(double x,
00376                      int n);
00377 #ifdef __VMATH_H__
00378 BN_EXPORT extern void tp_3axis(FILE *fp,
00379                      char *string,
00380                      point_t origin,
00381                      mat_t rot,
00382                      double length,
00383                      int ccw,
00384                      int ndigits,
00385                      double label_start,
00386                      double label_incr,
00387                      double tick_separation,
00388                      double char_width);
00389 BN_EXPORT extern void BU_FORTRAN(f3axis, F3AXIS)(FILE **fp,
00390                      char *string,
00391                      float *x,
00392                      float *y,
00393                      float *z,
00394                      float *length,
00395                      float *theta,
00396                      int *ccw,
00397                      int *ndigits,
00398                      float *label_start,
00399                      float *label_incr,
00400                      float *tick_separation,
00401                      float *char_width);
00402 BN_EXPORT extern void tp_3symbol(FILE *fp,
00403                      char *string,
00404                      point_t origin,
00405                      mat_t rot,
00406                      double scale);
00407 BN_EXPORT extern void tp_3vector(FILE *plotfp,
00408                      point_t from,
00409                      point_t to,
00410                      double fromheadfract,
00411                      double toheadfract);
00412 BN_EXPORT extern void BU_FORTRAN(f3vect, F3VECT)(FILE **fp,
00413                      float *fx,
00414                      float *fy,
00415                      float *fz,
00416                      float *tx,
00417                      float *ty,
00418                      float *tz,
00419                      float *fl,
00420                      float *tl);
00421 #endif /* __VMATH_H__ */
00422 
00423 #ifdef __cplusplus
00424 }
00425 #endif
00426 
00427 
00428 #endif /* PLOT3_H */
00429 /** @} */
00430 /*
00431  * Local Variables:
00432  * mode: C
00433  * tab-width: 8
00434  * indent-tabs-mode: t
00435  * c-file-style: "stroustrup"
00436  * End:
00437  * ex: shiftwidth=4 tabstop=8
00438  */
Generated on Tue Dec 11 13:14:27 2012 for LIBBN by  doxygen 1.6.3