GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71933
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viz.h
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <math.h>
3 #include <sys/types.h>
4 
5 #define GRID_ID "grid003.02"
6 #define DSPF_ID "dspf003.02"
7 
8 #define LINTERP(A,B,C) ((C-A)/(B-A))*255
9 #define VOID_TYPE char
10 
11 #define FLINTERP(A,B,C,D,E) (((C-A)*(E-D))/(B-A)) + D
12 /*#define LENGTH(A,B,C) sqrt(A*A + B*B + C*C) */
13 
14 /* used in the lambert shading model */
15 #define NV(A,B,C) ((A*A) + (B*B) + (C*C))
16 #define MAXLITS 3
17 
18 #define MAXTHRESH 127
19 #define MAXPOLY 10
20 
21 typedef struct
22 {
23  int nthres; /* number of thresholds */
24  float tvalue[MAXTHRESH]; /* array of threshold values */
25  int litmodel; /* 1 = flat, 2 = gradient(6), 3 = gradient(26) */
26 } cmndln_info;
27 
28 typedef struct
29 {
30  int token; /*type of file */
31  void *g3mapin, *g3mapout; /* RASTER3D_Map */
32  FILE *datainfp, *dataoutfp;
33  FILE *dspfinfp, *dspfoutfp;
34  int xdim, ydim, zdim;
35  float north, south, east, west;
36  float top, bottom;
37  float ns_res, ew_res, tb_res;
38  int zone;
39  int proj;
40  int type; /*1 = short int, 2 = integer, 3 = float */
41  float min, max; /* max and min values present in the data */
42  long Dataoff; /* offset of beginning of data in file */
43  long Lookoff; /* offset of beginning of lookup table in file */
44  cmndln_info linefax; /* more global info */
45  int headsize; /* size of datainf file header, necessary for random
46  access to grid3 data */
47 } file_info;
48 
49 
50 typedef struct
51 {
52  float v1[3]; /*polygon vertices */
53  float v2[3];
54  float v3[3];
55  float n1[3], n2[3], n3[3]; /*normals for vertices */
56 } poly_info;
57 
58 typedef struct
59 {
60  int npoly; /* number of polygons in cube at given threshold */
61  int t_ndx; /* index of given threshold */
62  poly_info poly[MAXPOLY]; /*vertices and normals */
63 } cube_info;
64 
65 typedef struct
66 {
67  int n_thresh;
69 } Cube_data;
70 
71 typedef struct
72 {
73  int nverts;
74  int verts[8];
75  int nedges;
76  int edges[12];
77  int npolys;
78  int polys[30];
79 } CELL_ENTRY; /* for writing out in condensed format */
80 
81 /* cube_io.c */
82 int write_cube(Cube_data *, int, file_info *);
83 int write_cube_buffer(unsigned char *, int, int, file_info *);
84 int read_cube(Cube_data *, file_info *);
85 int my_fread(char *, int, int, FILE *);
86 int my_fread(char *, int, int, FILE *);
87 int reset_reads(file_info *);
88 int new_dspf(file_info *);
89 
90 /* dspf_header.c */
93 int dfread_header_old(file_info *, FILE *);
94 
95 /* print_info.c */
97 
98 /* struct_copy.c */
99 int struct_copy(char *, char *, int);
100 
101 extern CELL_ENTRY cell_table[];
int dfread_header_old(file_info *headp, FILE *fp)
Definition: dspf_header.c:146
int write_cube(Cube_data *Cube, int cur_x, file_info *headfax)
Definition: cube_io.c:25
int dfwrite_header(file_info *headp)
Definition: dspf_header.c:8
FILE * dataoutfp
Definition: viz.h:32
int token
Definition: viz.h:30
float tb_res
Definition: viz.h:37
int litmodel
Definition: viz.h:25
float min
Definition: viz.h:41
int struct_copy(char *To, char *From, int size)
Definition: struct_copy.c:2
Definition: viz.h:28
int npolys
Definition: viz.h:77
#define max(x, y)
Definition: draw2.c:32
int nverts
Definition: viz.h:73
int write_cube_buffer(unsigned char *Buffer, int size, int cur_x, file_info *headfax)
Definition: cube_io.c:93
int t_ndx
Definition: viz.h:61
Definition: viz.h:58
Definition: viz.h:50
int zone
Definition: viz.h:38
int type
Definition: viz.h:40
Definition: viz.h:71
int dfread_header(file_info *headp)
Definition: dspf_header.c:91
int nedges
Definition: viz.h:75
#define MAXTHRESH
Definition: viz.h:18
#define MAXPOLY
Definition: viz.h:19
Definition: viz.h:65
cmndln_info linefax
Definition: viz.h:44
int my_fread(char *buf, int size, int cnt, FILE *fp)
Definition: cube_io.c:267
void * g3mapout
Definition: viz.h:31
long Dataoff
Definition: viz.h:42
int n_thresh
Definition: viz.h:67
int new_dspf(file_info *hfax)
Definition: cube_io.c:295
int zdim
Definition: viz.h:34
long Lookoff
Definition: viz.h:43
int read_cube(Cube_data *Cube, file_info *headfax)
Definition: cube_io.c:134
int headsize
Definition: viz.h:45
int npoly
Definition: viz.h:60
float west
Definition: viz.h:35
FILE * dspfoutfp
Definition: viz.h:33
int proj
Definition: viz.h:39
CELL_ENTRY cell_table[256]
Definition: cell_table.c:3
float top
Definition: viz.h:36
int reset_reads(file_info *headfax)
Definition: cube_io.c:285
int nthres
Definition: viz.h:23