GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
OGSF library - calculation normals (lower level functions) More...
#include <math.h>
#include <grass/gis.h>
#include <grass/ogsf.h>
#include "gsget.h"
#include "rowcol.h"
Go to the source code of this file.
Macros | |
#define | NTOP 0x00001000 |
#define | NBOT 0x00000100 |
#define | NLFT 0x00000010 |
#define | NRGT 0x00000001 |
#define | NALL 0x00001111 |
#define | NTL 0x00001010 |
#define | NTR 0x00001001 |
#define | NBL 0x00000110 |
#define | NBR 0x00000101 |
#define | SET_NORM(i) |
This macro is only used in the function calc_norm() More... | |
Functions | |
void | init_vars (geosurf *gs) |
Init variables. More... | |
int | gs_calc_normals (geosurf *gs) |
Calculate normals. More... | |
int | calc_norm (geosurf *gs, int drow, int dcol, unsigned int neighbors) |
Calculate normals. More... | |
OGSF library - calculation normals (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 gs_norms.c.
#define NALL 0x00001111 |
Definition at line 32 of file gs_norms.c.
Referenced by gs_calc_normals().
#define NBL 0x00000110 |
Definition at line 36 of file gs_norms.c.
Referenced by gs_calc_normals().
#define NBOT 0x00000100 |
Definition at line 28 of file gs_norms.c.
Referenced by calc_norm(), and gs_calc_normals().
#define NBR 0x00000101 |
Definition at line 37 of file gs_norms.c.
Referenced by gs_calc_normals().
#define NLFT 0x00000010 |
Definition at line 29 of file gs_norms.c.
Referenced by calc_norm(), and gs_calc_normals().
#define NRGT 0x00000001 |
Definition at line 30 of file gs_norms.c.
Referenced by calc_norm(), and gs_calc_normals().
#define NTL 0x00001010 |
Definition at line 34 of file gs_norms.c.
Referenced by gs_calc_normals().
#define NTOP 0x00001000 |
Definition at line 27 of file gs_norms.c.
Referenced by calc_norm(), and gs_calc_normals().
#define NTR 0x00001001 |
Definition at line 35 of file gs_norms.c.
Referenced by gs_calc_normals().
#define SET_NORM | ( | i | ) |
This macro is only used in the function calc_norm()
Definition at line 42 of file gs_norms.c.
int calc_norm | ( | geosurf * | gs, |
int | drow, | ||
int | dcol, | ||
unsigned int | neighbors | ||
) |
Calculate normals.
Need either four neighbors or two non-linear neighbors passed initial state of neighbors known from array position and data row & col
gs | surface (geosurf) |
drow | data row |
dcol | data col |
neighbors | neighbors id |
Definition at line 206 of file gs_norms.c.
References BM_get(), g_surf::curmask, DRC2OFF, GET_MAPATT, NBOT, NLFT, NRGT, NTOP, g_surf::x_mod, and g_surf::y_mod.
Referenced by gs_calc_normals().
int gs_calc_normals | ( | geosurf * | gs | ) |
Calculate normals.
OPTIMIZED for constant dy & dx
The norm array is always the same size, but diff resolutions force resampled data points to have their normals recalculated, then only those norms are passed to n3f during drawing. Norms are converted to a packed unsigned int for storage, must be converted back at time of use.
Uses the previous and next cells (when available) for normal calculations to produce smoother normals
gs | surface (geosurf) |
Definition at line 124 of file gs_norms.c.
References calc_norm(), G_debug(), gs_update_curmask(), g_surf::gsurf_id, init_vars(), NALL, NBL, NBOT, NBR, NLFT, g_surf::norm_needupdate, g_surf::norms, NRGT, NTL, NTOP, NTR, VCOLS, VROWS, g_surf::x_mod, and g_surf::y_mod.
Referenced by GS_get_norm_at_xy(), GS_update_normals(), and gsd_surf().
void init_vars | ( | geosurf * | gs | ) |
Init variables.
for optimization
gs | surface (geosurf) |
Definition at line 72 of file gs_norms.c.
Referenced by gs_calc_normals().