GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
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.
#define NBL 0x00000110 |
Definition at line 36 of file gs_norms.c.
#define NBOT 0x00000100 |
Definition at line 28 of file gs_norms.c.
#define NBR 0x00000101 |
Definition at line 37 of file gs_norms.c.
#define NLFT 0x00000010 |
Definition at line 29 of file gs_norms.c.
#define NRGT 0x00000001 |
Definition at line 30 of file gs_norms.c.
#define NTL 0x00001010 |
Definition at line 34 of file gs_norms.c.
#define NTOP 0x00001000 |
Definition at line 27 of file gs_norms.c.
#define NTR 0x00001001 |
Definition at line 35 of file gs_norms.c.
#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 73 of file gs_norms.c.
Referenced by gs_calc_normals().