Loading...
Searching...
No Matches
viz.h
Go to the documentation of this file.
#include <stdio.h>
#include <math.h>
#include <sys/types.h>
#define GRID_ID "grid003.02"
#define DSPF_ID "dspf003.02"
#define LINTERP(A, B, C) ((C - A) / (B - A)) * 255
#define VOID_TYPE char
#define FLINTERP(A, B, C, D, E) (((C - A) * (E - D)) / (B - A)) + D
/*#define LENGTH(A,B,C) sqrt(A*A + B*B + C*C) */
/* used in the lambert shading model */
#define NV(A, B, C) ((A * A) + (B * B) + (C * C))
#define MAXLITS 3
#define MAXTHRESH 127
#define MAXPOLY 10
typedef struct {
int nthres; /* number of thresholds */
float tvalue[MAXTHRESH]; /* array of threshold values */
int litmodel; /* 1 = flat, 2 = gradient(6), 3 = gradient(26) */
} cmndln_info;
typedef struct {
int token; /* type of file */
void *g3mapin, *g3mapout; /* RASTER3D_Map */
FILE *datainfp, *dataoutfp;
FILE *dspfinfp, *dspfoutfp;
int xdim, ydim, zdim;
float north, south, east, west;
float top, bottom;
float ns_res, ew_res, tb_res;
int zone;
int proj;
int type; /* 1 = short int, 2 = integer, 3 = float */
float min, max; /* max and min values present in the data */
long Dataoff; /* offset of beginning of data in file */
long Lookoff; /* offset of beginning of lookup table in file */
cmndln_info linefax; /* more global info */
int headsize; /* size of datainf file header, necessary for random
access to grid3 data */
} file_info;
typedef struct {
float v1[3]; /* polygon vertices */
float v2[3];
float v3[3];
float n1[3], n2[3], n3[3]; /* normals for vertices */
} poly_info;
typedef struct {
int npoly; /* number of polygons in cube at given threshold */
int t_ndx; /* index of given threshold */
poly_info poly[MAXPOLY]; /* vertices and normals */
} cube_info;
typedef struct {
int n_thresh;
cube_info data[MAXTHRESH];
} Cube_data;
typedef struct {
int nverts;
int verts[8];
int nedges;
int edges[12];
int npolys;
int polys[30];
} CELL_ENTRY; /* for writing out in condensed format */
/* cube_io.c */
int write_cube(Cube_data *, int, file_info *);
int write_cube_buffer(unsigned char *, int, int, file_info *);
int read_cube(Cube_data *, file_info *);
int my_fread(char *, int, int, FILE *);
int my_fread(char *, int, int, FILE *);
int reset_reads(file_info *);
int new_dspf(file_info *);
/* dspf_header.c */
int dfwrite_header(file_info *);
int dfread_header(file_info *);
int dfread_header_old(file_info *, FILE *);
/* print_info.c */
int print_head_info(file_info *);
/* struct_copy.c */
int struct_copy(char *, char *, int);
#ifdef GRASS_CMAKE_BUILD
#include <export/grass_dspf_export.h>
#else
#define GRASS_DSPF_EXPORT
#endif
extern GRASS_DSPF_EXPORT CELL_ENTRY cell_table[];
cell_table
CELL_ENTRY cell_table[256]
Definition cell_table.c:3
CELL_ENTRY
Definition viz.h:65
CELL_ENTRY::nverts
int nverts
Definition viz.h:66
CELL_ENTRY::npolys
int npolys
Definition viz.h:70
CELL_ENTRY::verts
int verts[8]
Definition viz.h:67
CELL_ENTRY::polys
int polys[30]
Definition viz.h:71
CELL_ENTRY::nedges
int nedges
Definition viz.h:68
CELL_ENTRY::edges
int edges[12]
Definition viz.h:69
Cube_data
Definition viz.h:60
Cube_data::n_thresh
int n_thresh
Definition viz.h:61
Cube_data::data
cube_info data[127]
Definition viz.h:62
cmndln_info
Definition viz.h:21
cmndln_info::tvalue
float tvalue[127]
Definition viz.h:23
cmndln_info::nthres
int nthres
Definition viz.h:22
cmndln_info::litmodel
int litmodel
Definition viz.h:24
cube_info
Definition viz.h:54
cube_info::poly
poly_info poly[10]
Definition viz.h:57
cube_info::t_ndx
int t_ndx
Definition viz.h:56
cube_info::npoly
int npoly
Definition viz.h:55
file_info
Definition viz.h:27
file_info::east
float east
Definition viz.h:33
file_info::zdim
int zdim
Definition viz.h:32
file_info::dataoutfp
FILE * dataoutfp
Definition viz.h:30
file_info::Lookoff
long Lookoff
Definition viz.h:41
file_info::tb_res
float tb_res
Definition viz.h:35
file_info::xdim
int xdim
Definition viz.h:32
file_info::ydim
int ydim
Definition viz.h:32
file_info::g3mapin
void * g3mapin
Definition viz.h:29
file_info::ns_res
float ns_res
Definition viz.h:35
file_info::g3mapout
void * g3mapout
Definition viz.h:29
file_info::proj
int proj
Definition viz.h:37
file_info::ew_res
float ew_res
Definition viz.h:35
file_info::datainfp
FILE * datainfp
Definition viz.h:30
file_info::dspfoutfp
FILE * dspfoutfp
Definition viz.h:31
file_info::south
float south
Definition viz.h:33
file_info::linefax
cmndln_info linefax
Definition viz.h:42
file_info::Dataoff
long Dataoff
Definition viz.h:40
file_info::west
float west
Definition viz.h:33
file_info::top
float top
Definition viz.h:34
file_info::dspfinfp
FILE * dspfinfp
Definition viz.h:31
file_info::type
int type
Definition viz.h:38
file_info::north
float north
Definition viz.h:33
file_info::min
float min
Definition viz.h:39
file_info::bottom
float bottom
Definition viz.h:34
file_info::max
float max
Definition viz.h:39
file_info::zone
int zone
Definition viz.h:36
file_info::token
int token
Definition viz.h:28
file_info::headsize
int headsize
Definition viz.h:43
poly_info
Definition viz.h:47
poly_info::v3
float v3[3]
Definition viz.h:50
poly_info::n2
float n2[3]
Definition viz.h:51
poly_info::v2
float v2[3]
Definition viz.h:49
poly_info::v1
float v1[3]
Definition viz.h:48
poly_info::n1
float n1[3]
Definition viz.h:51
poly_info::n3
float n3[3]
Definition viz.h:51
write_cube
int write_cube(Cube_data *, int, file_info *)
Definition cube_io.c:25
dfwrite_header
int dfwrite_header(file_info *)
Definition dspf_header.c:7
struct_copy
int struct_copy(char *, char *, int)
Definition struct_copy.c:1
read_cube
int read_cube(Cube_data *, file_info *)
Definition cube_io.c:136
write_cube_buffer
int write_cube_buffer(unsigned char *, int, int, file_info *)
Definition cube_io.c:95
new_dspf
int new_dspf(file_info *)
Definition cube_io.c:284
dfread_header_old
int dfread_header_old(file_info *, FILE *)
Definition dspf_header.c:139
MAXPOLY
#define MAXPOLY
Definition viz.h:19
GRASS_DSPF_EXPORT
#define GRASS_DSPF_EXPORT
Definition viz.h:96
print_head_info
int print_head_info(file_info *)
Definition print_info.c:3
MAXTHRESH
#define MAXTHRESH
Definition viz.h:18
my_fread
int my_fread(char *, int, int, FILE *)
Definition cube_io.c:256
reset_reads
int reset_reads(file_info *)
Definition cube_io.c:274
dfread_header
int dfread_header(file_info *)
Definition dspf_header.c:85