| 1 | /* GNUPLOT - graph3d.h */ | 
|---|
| 2 |  | 
|---|
| 3 | /*[ | 
|---|
| 4 | * Copyright 1999   Thomas Williams, Colin Kelley | 
|---|
| 5 | * | 
|---|
| 6 | * Permission to use, copy, and distribute this software and its | 
|---|
| 7 | * documentation for any purpose with or without fee is hereby granted, | 
|---|
| 8 | * provided that the above copyright notice appear in all copies and | 
|---|
| 9 | * that both that copyright notice and this permission notice appear | 
|---|
| 10 | * in supporting documentation. | 
|---|
| 11 | * | 
|---|
| 12 | * Permission to modify the software is granted, but not the right to | 
|---|
| 13 | * distribute the complete modified source code.  Modifications are to | 
|---|
| 14 | * be distributed as patches to the released version.  Permission to | 
|---|
| 15 | * distribute binaries produced by compiling modified sources is granted, | 
|---|
| 16 | * provided you | 
|---|
| 17 | *   1. distribute the corresponding source modifications from the | 
|---|
| 18 | *    released version in the form of a patch file along with the binaries, | 
|---|
| 19 | *   2. add special version identification to distinguish your version | 
|---|
| 20 | *    in addition to the base release version number, | 
|---|
| 21 | *   3. provide your name and address as the primary contact for the | 
|---|
| 22 | *    support of your modified version, and | 
|---|
| 23 | *   4. retain our contact information in regard to use of the base | 
|---|
| 24 | *    software. | 
|---|
| 25 | * Permission to distribute the released version of the source code along | 
|---|
| 26 | * with corresponding source modifications in the form of a patch file is | 
|---|
| 27 | * granted with same provisions 2 through 4 for binary distributions. | 
|---|
| 28 | * | 
|---|
| 29 | * This software is provided "as is" without express or implied warranty | 
|---|
| 30 | * to the extent permitted by applicable law. | 
|---|
| 31 | ]*/ | 
|---|
| 32 |  | 
|---|
| 33 | #ifndef GNUPLOT_GRAPH3D_H | 
|---|
| 34 | # define GNUPLOT_GRAPH3D_H | 
|---|
| 35 |  | 
|---|
| 36 | /* #if... / #include / #define collection: */ | 
|---|
| 37 |  | 
|---|
| 38 | /*** | 
|---|
| 39 | #include "syscfg.h" | 
|---|
| 40 |  | 
|---|
| 41 | #include "gadgets.h" | 
|---|
| 42 | #include "term_api.h" | 
|---|
| 43 | ****/ | 
|---|
| 44 |  | 
|---|
| 45 | #include <stdio.h> | 
|---|
| 46 | #include <stdlib.h> | 
|---|
| 47 | #include "gp_types.h" | 
|---|
| 48 | #include "gpc_misc.h" | 
|---|
| 49 | /* Function macros to map from user 3D space into normalized -1..1 */ | 
|---|
| 50 | #define map_x3d(x) ((x-X_AXIS.min)*xscale3d-1.0) | 
|---|
| 51 | #define map_y3d(y) ((y-Y_AXIS.min)*yscale3d-1.0) | 
|---|
| 52 | #define map_z3d(z) ((z-floor_z)*zscale3d-1.0) | 
|---|
| 53 |  | 
|---|
| 54 | /* Type definitions */ | 
|---|
| 55 |  | 
|---|
| 56 | typedef enum en_contour_placement { | 
|---|
| 57 | /* Where to place contour maps if at all. */ | 
|---|
| 58 | CONTOUR_NONE, | 
|---|
| 59 | CONTOUR_BASE, | 
|---|
| 60 | CONTOUR_SRF, | 
|---|
| 61 | CONTOUR_BOTH | 
|---|
| 62 | } t_contour_placement; | 
|---|
| 63 |  | 
|---|
| 64 | typedef double transform_matrix[4][4]; /* HBB 990826: added */ | 
|---|
| 65 |  | 
|---|
| 66 | typedef struct gnuplot_contours { | 
|---|
| 67 | struct gnuplot_contours *next; | 
|---|
| 68 | struct coordinate *coords; | 
|---|
| 69 | char isNewLevel; | 
|---|
| 70 | char label[32]; | 
|---|
| 71 | int num_pts; | 
|---|
| 72 | #ifdef PM3D | 
|---|
| 73 | double z; | 
|---|
| 74 | #endif | 
|---|
| 75 | } gnuplot_contours; | 
|---|
| 76 |  | 
|---|
| 77 | typedef struct iso_curve { | 
|---|
| 78 | struct iso_curve *next; | 
|---|
| 79 | int p_max;                  /* how many points are allocated */ | 
|---|
| 80 | int p_count;                        /* count of points in points */ | 
|---|
| 81 | struct coordinate  *points; | 
|---|
| 82 | } iso_curve; | 
|---|
| 83 |  | 
|---|
| 84 | typedef struct surface_points { | 
|---|
| 85 | struct surface_points *next_sp; /* linked list */ | 
|---|
| 86 | int token;                  /* last token nr, for second pass */ | 
|---|
| 87 | enum PLOT_TYPE plot_type; | 
|---|
| 88 | enum PLOT_STYLE plot_style; | 
|---|
| 89 | char *title; | 
|---|
| 90 | int title_no_enhanced;      /* don't typeset title in enhanced mode */ | 
|---|
| 91 | /*struct lp_style_type lp_properties;*/ | 
|---|
| 92 | int has_grid_topology; | 
|---|
| 93 |  | 
|---|
| 94 | /* Data files only - num of isolines read from file. For | 
|---|
| 95 | * functions, num_iso_read is the number of 'primary' isolines (in | 
|---|
| 96 | * x direction) */ | 
|---|
| 97 | int num_iso_read; | 
|---|
| 98 | struct gnuplot_contours *contours; /* NULL if not doing contours. */ | 
|---|
| 99 | struct iso_curve *iso_crvs; /* the actual data */ | 
|---|
| 100 |  | 
|---|
| 101 | #ifdef PM3D_COLUMN | 
|---|
| 102 | int pm3d_color_from_column; | 
|---|
| 103 | coordval color_min; | 
|---|
| 104 | coordval color_max; | 
|---|
| 105 | #endif | 
|---|
| 106 |  | 
|---|
| 107 | } surface_points; | 
|---|
| 108 |  | 
|---|
| 109 | /* Variables of graph3d.c needed by other modules: */ | 
|---|
| 110 |  | 
|---|
| 111 | extern int xmiddle, ymiddle, xscaler, yscaler; | 
|---|
| 112 | extern double floor_z; | 
|---|
| 113 | extern double ceiling_z, base_z; /* made exportable for PM3D */ | 
|---|
| 114 | extern transform_matrix trans_mat; | 
|---|
| 115 | extern double xscale3d, yscale3d, zscale3d; | 
|---|
| 116 |  | 
|---|
| 117 | extern t_contour_placement draw_contour; | 
|---|
| 118 | extern TBOOLEAN label_contours; | 
|---|
| 119 |  | 
|---|
| 120 | extern TBOOLEAN draw_surface; | 
|---|
| 121 |  | 
|---|
| 122 | /* is hidden3d display wanted? */ | 
|---|
| 123 | extern TBOOLEAN hidden3d; | 
|---|
| 124 |  | 
|---|
| 125 | extern float surface_rot_z; | 
|---|
| 126 | extern float surface_rot_x; | 
|---|
| 127 | extern float surface_scale; | 
|---|
| 128 | extern float surface_zscale; | 
|---|
| 129 |  | 
|---|
| 130 | extern float ticslevel; | 
|---|
| 131 |  | 
|---|
| 132 | #define ISO_SAMPLES 10          /* default number of isolines per splot */ | 
|---|
| 133 | extern int iso_samples_1; | 
|---|
| 134 | extern int iso_samples_2; | 
|---|
| 135 |  | 
|---|
| 136 | #ifdef USE_MOUSE | 
|---|
| 137 | extern int axis3d_o_x, axis3d_o_y, axis3d_x_dx, axis3d_x_dy, axis3d_y_dx, axis3d_y_dy; | 
|---|
| 138 | #endif | 
|---|
| 139 |  | 
|---|
| 140 | /* Prototypes from file "graph3d.c" */ | 
|---|
| 141 |  | 
|---|
| 142 | void do_3dplot (struct surface_points *plots, int pcount, int quick); | 
|---|
| 143 | void map3d_position (struct position * pos, unsigned int *x, | 
|---|
| 144 | unsigned int *y, const char *what); | 
|---|
| 145 |  | 
|---|
| 146 |  | 
|---|
| 147 | #endif /* GNUPLOT_GRAPH3D_H */ | 
|---|