GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
OGSF library - loading and manipulating volumes (lower level functions) More...
#include <math.h>
#include <grass/gis.h>
#include <grass/gstypes.h>
#include "rgbpack.h"
#include "mc33_table.h"
Go to the source code of this file.
Data Structures | |
struct | data_buffer |
Macros | |
#define | BUFFER_SIZE 1000000 |
memory buffer for writing More... | |
#define | LINTERP(d, a, b) (a + d * (b - a)) |
#define | TINTERP(d, v) |
#define | FOR_VAR i_for |
#define | FOR_0_TO_N(n, cmd) { int FOR_VAR; for (FOR_VAR = 0; FOR_VAR < n; FOR_VAR++) {cmd;} } |
#define | WRITE(c) gvl_write_char(dbuff->ndx_new++, &(dbuff->new), c) |
writing and reading isosurface data More... | |
#define | READ() gvl_read_char(dbuff->ndx_old++, dbuff->old) |
#define | SKIP(n) dbuff->ndx_old = dbuff->ndx_old + n |
#define | IS_IN_DATA(att) ((isosurf->data_desc >> att) & 1) |
check and set data descriptor More... | |
#define | SET_IN_DATA(att) isosurf->data_desc = (isosurf->data_desc | (1 << att)) |
#define | DISTANCE_2(x1, y1, x2, y2) sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) |
#define | SLICE_MODE_INTERP_NO 0 |
#define | SLICE_MODE_INTERP_YES 1 |
Functions | |
int | mc33_process_cube (int c_ndx, float *v) |
ADD. More... | |
void | iso_w_cndx (int ndx, data_buffer *dbuff) |
Write cube index. More... | |
int | iso_r_cndx (data_buffer *dbuff) |
Read cube index. More... | |
int | iso_get_cube_value (geovol_isosurf *isosurf, int desc, int x, int y, int z, float *v) |
Get value from data input. More... | |
void | iso_get_range (geovol_isosurf *isosurf, int desc, double *min, double *max) |
Get volume file values range. More... | |
int | iso_get_cube_values (geovol_isosurf *isosurf, int desc, int x, int y, int z, float *v) |
Read values for cube. More... | |
void | iso_get_cube_grads (geovol_isosurf *isosurf, int x, int y, int z, float(*grad)[3]) |
Calculate cube grads. More... | |
void | iso_calc_cube (geovol_isosurf *isosurf, int x, int y, int z, data_buffer *dbuff) |
Process cube. More... | |
int | gvl_isosurf_calc (geovol *gvol) |
Fill data structure with computed isosurfaces polygons. More... | |
void | gvl_write_char (int pos, unsigned char **data, unsigned char c) |
ADD. More... | |
unsigned char | gvl_read_char (int pos, const unsigned char *data) |
Read char. More... | |
void | gvl_align_data (int pos, unsigned char *data) |
Append data to buffer. More... | |
float | slice_get_value (geovol *gvl, int x, int y, int z) |
Get volume value. More... | |
int | slice_calc (geovol *gvl, int ndx_slc, void *colors) |
Calculate slices. More... | |
int | gvl_slices_calc (geovol *gvol) |
Calculate slices for given volume set. More... | |
Variables | |
int | Rows |
int | Cols |
int | Depths |
double | ResX |
double | ResY |
double | ResZ |
OGSF library - loading and manipulating volumes (lower level functions)
GRASS OpenGL gsurf OGSF Library
(C) 1999-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file gvl_calc.c.
#define BUFFER_SIZE 1000000 |
#define DISTANCE_2 | ( | x1, | |
y1, | |||
x2, | |||
y2 | |||
) | sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) |
Definition at line 795 of file gvl_calc.c.
Referenced by slice_calc().
Definition at line 46 of file gvl_calc.c.
Referenced by iso_calc_cube().
#define FOR_VAR i_for |
Definition at line 45 of file gvl_calc.c.
Referenced by iso_calc_cube().
#define IS_IN_DATA | ( | att | ) | ((isosurf->data_desc >> att) & 1) |
check and set data descriptor
Definition at line 58 of file gvl_calc.c.
Referenced by gvl_isosurf_calc(), and iso_calc_cube().
Definition at line 35 of file gvl_calc.c.
Referenced by iso_calc_cube().
#define READ | ( | ) | gvl_read_char(dbuff->ndx_old++, dbuff->old) |
Definition at line 52 of file gvl_calc.c.
Referenced by iso_calc_cube(), and iso_r_cndx().
#define SET_IN_DATA | ( | att | ) | isosurf->data_desc = (isosurf->data_desc | (1 << att)) |
Definition at line 59 of file gvl_calc.c.
Referenced by gvl_isosurf_calc().
Definition at line 53 of file gvl_calc.c.
Referenced by iso_calc_cube().
#define SLICE_MODE_INTERP_NO 0 |
Definition at line 797 of file gvl_calc.c.
#define SLICE_MODE_INTERP_YES 1 |
Definition at line 798 of file gvl_calc.c.
Referenced by slice_calc().
#define TINTERP | ( | d, | |
v | |||
) |
Definition at line 36 of file gvl_calc.c.
Referenced by iso_calc_cube().
#define WRITE | ( | c | ) | gvl_write_char(dbuff->ndx_new++, &(dbuff->new), c) |
writing and reading isosurface data
Definition at line 51 of file gvl_calc.c.
Referenced by iso_calc_cube(), iso_r_cndx(), and iso_w_cndx().
void gvl_align_data | ( | int | pos, |
unsigned char * | data | ||
) |
Append data to buffer.
pos | position index |
data | data buffer |
Definition at line 771 of file gvl_calc.c.
References G_debug(), and tools::pos.
int gvl_isosurf_calc | ( | geovol * | gvol | ) |
Fill data structure with computed isosurfaces polygons.
gvol | pointer to geovol struct |
Definition at line 584 of file gvl_calc.c.
References Cols, Depths, G_free(), gvl_file_end_read(), gvl_file_get_volfile(), gvl_file_set_mode(), gvl_file_start_read(), gvl_write_char(), IS_IN_DATA, iso_calc_cube(), data_buffer::ndx_new, data_buffer::ndx_old, data_buffer::new, NULL, data_buffer::num_zero, data_buffer::old, ResX, ResY, ResZ, Rows, SET_IN_DATA, and y.
Referenced by gvld_vol().
unsigned char gvl_read_char | ( | int | pos, |
const unsigned char * | data | ||
) |
Read char.
pos | position index |
data | data buffer |
Definition at line 757 of file gvl_calc.c.
References tools::pos.
int gvl_slices_calc | ( | geovol * | gvol | ) |
Calculate slices for given volume set.
gvol | pointer to geovol struct |
Definition at line 1027 of file gvl_calc.c.
References Cols, Depths, G_debug(), gvl_file_get_name(), Gvl_load_colors_data(), Gvl_unload_colors_data(), ResX, ResY, ResZ, Rows, and slice_calc().
Referenced by gvld_vol().
void gvl_write_char | ( | int | pos, |
unsigned char ** | data, | ||
unsigned char | c | ||
) |
ADD.
pos | |
data | |
c |
Definition at line 729 of file gvl_calc.c.
References BUFFER_SIZE, G_debug(), and tools::pos.
Referenced by gvl_isosurf_calc(), and slice_calc().
void iso_calc_cube | ( | geovol_isosurf * | isosurf, |
int | x, | ||
int | y, | ||
int | z, | ||
data_buffer * | dbuff | ||
) |
Process cube.
isosurf | |
x,y,z | |
dbuff |
Definition at line 323 of file gvl_calc.c.
References BLU_MASK, cell_table, CELL_ENTRY::edges, FOR_0_TO_N, FOR_VAR, GRN_MASK, GS_v3norm(), Gvl_get_color_for_value(), IS_IN_DATA, iso_get_cube_grads(), iso_get_cube_values(), iso_get_range(), iso_r_cndx(), iso_w_cndx(), LINTERP, max, mc33_process_cube(), min, n, CELL_ENTRY::nedges, READ, RED_MASK, SKIP, TINTERP, and WRITE.
Referenced by gvl_isosurf_calc().
Calculate cube grads.
isosurf | |
x,y,z | |
grad |
Definition at line 246 of file gvl_calc.c.
References Cols, Depths, iso_get_cube_value(), and Rows.
Referenced by iso_calc_cube().
Get value from data input.
isosurf | ||
desc | ||
x,y,z | ||
[out] | value |
Definition at line 155 of file gvl_calc.c.
References gvl_file_get_data_type(), gvl_file_get_value(), gvl_file_get_volfile(), gvl_file_is_null_value(), ResX, ResY, ResZ, and dialogs::type.
Referenced by iso_get_cube_grads(), and iso_get_cube_values().
Read values for cube.
isosurf | ||
desc | ||
x,y,z | ||
[out] | v |
Definition at line 223 of file gvl_calc.c.
References iso_get_cube_value().
Referenced by iso_calc_cube().
void iso_get_range | ( | geovol_isosurf * | isosurf, |
int | desc, | ||
double * | min, | ||
double * | max | ||
) |
Get volume file values range.
isosurf | ||
desc | ||
[out] | min | |
[out] | max |
Definition at line 206 of file gvl_calc.c.
References gvl_file_get_min_max(), and gvl_file_get_volfile().
Referenced by iso_calc_cube().
int iso_r_cndx | ( | data_buffer * | dbuff | ) |
Read cube index.
dbuff |
Definition at line 120 of file gvl_calc.c.
References data_buffer::num_zero, READ, and WRITE.
Referenced by iso_calc_cube().
void iso_w_cndx | ( | int | ndx, |
data_buffer * | dbuff | ||
) |
Write cube index.
ndx | |
dbuff |
Definition at line 85 of file gvl_calc.c.
References data_buffer::num_zero, and WRITE.
Referenced by iso_calc_cube().
ADD.
c_ndx | |
v |
Definition at line 307 of file gvl_calc2.c.
References m_case, m_config, m_subconfig, mc33_test_face(), mc33_test_interior(), OFFSET_T1, OFFSET_T10_1_1_S1, OFFSET_T10_1_1_S2, OFFSET_T10_1_2, OFFSET_T10_2_S1, OFFSET_T10_2_S2, OFFSET_T11, OFFSET_T12_1_1_S1, OFFSET_T12_1_1_S2, OFFSET_T12_1_2, OFFSET_T12_2_S1, OFFSET_T12_2_S2, OFFSET_T13_1_S1, OFFSET_T13_1_S2, OFFSET_T13_2_S1, OFFSET_T13_2_S2, OFFSET_T13_3_S1, OFFSET_T13_3_S2, OFFSET_T13_4, OFFSET_T13_5_1, OFFSET_T13_5_2, OFFSET_T14, OFFSET_T2, OFFSET_T3_1, OFFSET_T3_2, OFFSET_T4_1, OFFSET_T4_2, OFFSET_T5, OFFSET_T6_1_1, OFFSET_T6_1_2, OFFSET_T6_2, OFFSET_T7_1, OFFSET_T7_2_S1, OFFSET_T7_2_S2, OFFSET_T7_2_S3, OFFSET_T7_3_S1, OFFSET_T7_3_S2, OFFSET_T7_3_S3, OFFSET_T7_4_1, OFFSET_T7_4_2, OFFSET_T8, OFFSET_T9, OFFSET_TEST10, OFFSET_TEST12, OFFSET_TEST13, OFFSET_TEST3, OFFSET_TEST4, OFFSET_TEST6, and OFFSET_TEST7.
Referenced by iso_calc_cube().
Calculate slices.
gvl | pointer to geovol struct |
ndx_slc | |
colors |
Definition at line 847 of file gvl_calc.c.
References BLU_MASK, tools::color, dialogs::cols, DISTANCE_2, GRN_MASK, gvl_file_end_read(), gvl_file_get_volfile(), gvl_file_set_mode(), gvl_file_start_read(), Gvl_get_color_for_value(), gvl_write_char(), int, tools::pos, r, RED_MASK, ResX, ResY, ResZ, slice_get_value(), SLICE_MODE_INTERP_YES, value, X, y, and Y.
Referenced by gvl_slices_calc().
Get volume value.
gvl | pointer to geovol struct |
x,y,z |
Definition at line 808 of file gvl_calc.c.
References gvl_file_get_data_type(), gvl_file_get_value(), gvl_file_get_volfile(), dialogs::type, and value.
Referenced by slice_calc().
int Cols |
Definition at line 73 of file gvl_calc.c.
Referenced by alloc_slice_buff(), alloc_vol_buff(), get_slice_value(), get_vol_value(), gvl_isosurf_calc(), gvl_slices_calc(), iso_get_cube_grads(), read_g3d_slice(), and read_g3d_vol().
int Depths |
Definition at line 73 of file gvl_calc.c.
Referenced by alloc_vol_buff(), gvl_isosurf_calc(), gvl_slices_calc(), iso_get_cube_grads(), and read_g3d_vol().
double ResX |
Definition at line 74 of file gvl_calc.c.
Referenced by gvl_isosurf_calc(), gvl_slices_calc(), iso_get_cube_value(), and slice_calc().
double ResY |
Definition at line 74 of file gvl_calc.c.
Referenced by gvl_isosurf_calc(), gvl_slices_calc(), iso_get_cube_value(), and slice_calc().
double ResZ |
Definition at line 74 of file gvl_calc.c.
Referenced by gvl_isosurf_calc(), gvl_slices_calc(), iso_get_cube_value(), and slice_calc().
int Rows |
Definition at line 73 of file gvl_calc.c.
Referenced by alloc_slice_buff(), alloc_vol_buff(), get_vol_value(), gvl_isosurf_calc(), gvl_slices_calc(), iso_get_cube_grads(), read_g3d_slice(), and read_g3d_vol().