grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gsd_surf.c File Reference

OGSF library - loading and manipulating surfaces. More...

#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/ogsf.h>
#include "gsget.h"
#include "rowcol.h"
Include dependency graph for gsd_surf.c:

Go to the source code of this file.

Macros

#define DEBUG_ARROW   (0)
 
#define SET_SCOLOR(sf)
 MACROS for use in gsd_ortho_wall ONLY !!! More...
 

Functions

static int transpoint_is_masked (geosurf *surf, Point3 point)
 ADD. More...
 
static int get_point_below (Point3 **points, geosurf **gsurfs, int ptn, int cursurf, int numsurfs, int *belowsurf)
 ADD. More...
 
int gsd_surf (geosurf *surf)
 ADD. More...
 
int gsd_surf_map_old (geosurf *surf)
 ADD. More...
 
int gsd_surf_const (geosurf *surf, float k)
 Using tmesh - not confident with qstrips portability. More...
 
int gsd_surf_func (geosurf *gs, int(*user_func)())
 Define user function. More...
 
int gsd_triangulated_wall (int npts1, int npts2, geosurf *surf1, geosurf *surf2, Point3 *points1, Point3 *points2, float *norm)
 ADD. More...
 
void gsd_setfc (int mode)
 ADD. More...
 
int gsd_getfc (void)
 ADD. More...
 
int gsd_ortho_wall (int np, int ns, geosurf **gsurfs, Point3 **points, float *norm)
 ADD. More...
 
int gsd_wall (float *bgn, float *end, float *norm)
 ADD. More...
 
int gsd_norm_arrows (geosurf *surf)
 ADD. More...
 
int gsd_surf_map (geosurf *surf)
 Draw surface using triangle fan instead of strip. More...
 

Variables

static int FCmode
 

Detailed Description

OGSF library - loading and manipulating surfaces.

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.

Author
Bill Brown USACERL (October 1993)
Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)

Definition in file gsd_surf.c.

Macro Definition Documentation

◆ DEBUG_ARROW

#define DEBUG_ARROW   (0)

Definition at line 41 of file gsd_surf.c.

◆ SET_SCOLOR

#define SET_SCOLOR (   sf)
Value:
if(check_color[sf]) \
{ \
tx = points[sf][i][X] - gsurfs[sf]->x_trans; \
ty = points[sf][i][Y] - gsurfs[sf]->y_trans; \
offset = XY2OFF(gsurfs[sf], tx, ty); \
colors[sf] = gs_mapcolor(cobuf[sf], coloratt[sf], offset); \
}
int gs_mapcolor(typbuff *cobuff, gsurf_att *coloratt, int offset)
Call this one when you already know att_src is MAP_ATT.
Definition: gs.c:969
#define X
Definition: ogsf.h:137
#define Y
Definition: ogsf.h:138
#define XY2OFF(gs, px, py)
Definition: rowcol.h:24

MACROS for use in gsd_ortho_wall ONLY !!!

Definition at line 46 of file gsd_surf.c.

Function Documentation

◆ get_point_below()

static int get_point_below ( Point3 **  points,
geosurf **  gsurfs,
int  ptn,
int  cursurf,
int  numsurfs,
int *  belowsurf 
)
static

ADD.

Parameters
points
gsurf
ptn
cursurf
numsurfs
belowsurf
Returns
0 if there is no surface below the current,
-1 if the current surface is masked,
1 if the surface below the current surface is not masked (belowsurf is assigned)

Definition at line 1258 of file gsd_surf.c.

References transpoint_is_masked(), and Z.

Referenced by gsd_ortho_wall().

◆ gsd_getfc()

int gsd_getfc ( void  )

ADD.

Returns

Definition at line 1220 of file gsd_surf.c.

References FCmode.

Referenced by GS_get_fencecolor(), and GS_transp_is_set().

◆ gsd_norm_arrows()

◆ gsd_ortho_wall()

◆ gsd_setfc()

void gsd_setfc ( int  mode)

ADD.

Parameters
mode

Definition at line 1208 of file gsd_surf.c.

References FCmode, and mode().

Referenced by GS_set_fencecolor().

◆ gsd_surf()

int gsd_surf ( geosurf surf)

◆ gsd_surf_const()

◆ gsd_surf_func()

int gsd_surf_func ( geosurf gs,
int(*)()  user_func 
)

Define user function.

Not yet supported

Parameters
gssurface (geosurf)
user_funcuser function
Returns
1

Definition at line 1092 of file gsd_surf.c.

Referenced by gsd_surf().

◆ gsd_surf_map()

int gsd_surf_map ( geosurf surf)

Draw surface using triangle fan instead of strip.

Optimized by getting rid of BM_get mask check - GET_MAPPATT does same and returns zero if masked

Only do in window check on Fan center(v0) to further optimize – this runs the risk of trimming points in view !!

Parameters
surfsurface (geosurf)
Returns

Definition at line 2062 of file gsd_surf.c.

References g_surf::att, ATT_COLOR, ATT_EMIT, ATT_SHINE, gsurf_att::att_src, ATT_TOPO, ATT_TRANSP, CM_DIFFUSE, g_surf::cols, CONST_ATT, gsurf_att::constant, g_surf::curmask, FNORM, GET_MAPATT, GS_check_cancel(), gs_get_att_typbuff(), GS_get_scale(), GS_global_exag(), gs_mapcolor(), gs_update_curmask(), gsd_bgntfan(), gsd_blend(), gsd_checkpoint(), gsd_colormode(), gsd_do_scale(), gsd_endtfan(), gsd_getwindow(), gsd_litvert_func(), gsd_popmatrix(), gsd_pushmatrix(), gsd_set_material(), gsd_surf_const(), gsd_translate(), gsd_zwritemask(), MAP_ATT, g_surf::norms, g_surf::rows, SCALE_ATT, VCOLS, VROWS, window, g_surf::wire_color, X, x1, x2, g_surf::x_mod, g_surf::x_trans, g_surf::xres, Y, g_surf::y_mod, g_surf::y_trans, g_surf::yres, Z, g_surf::z_exag, and g_surf::z_trans.

Referenced by gsd_surf().

◆ gsd_surf_map_old()

◆ gsd_triangulated_wall()

int gsd_triangulated_wall ( int  npts1,
int  npts2,
geosurf surf1,
geosurf surf2,
Point3 points1,
Point3 points2,
float *  norm 
)

ADD.

Parameters
npts1
npts2
surf1first surface (geosurf)
surf2second surface (geosurf)
points1
points2
norm
Returns
1

Definition at line 1111 of file gsd_surf.c.

References g_surf::att, ATT_COLOR, gsurf_att::att_src, CM_DIFFUSE, CONST_ATT, gsurf_att::constant, gs_get_att_typbuff(), gs_mapcolor(), gsd_bgntmesh(), gsd_colormode(), gsd_do_scale(), gsd_endtmesh(), gsd_litvert_func(), gsd_popmatrix(), gsd_pushmatrix(), MAP_ATT, norm, g_surf::wire_color, X, g_surf::x_trans, XY2OFF, Y, g_surf::y_trans, Z, and g_surf::z_trans.

◆ gsd_wall()

int gsd_wall ( float *  bgn,
float *  end,
float *  norm 
)

ADD.

bgn,end should already be in world modeling coords, but have to be reverse-translated to apply to each surface

Parameters
bgn,end2d line for cutting plane
normindicates which way wall faces
Returns

Definition at line 1715 of file gsd_surf.c.

References _, err(), FC_OFF, FCmode, G_free(), G_warning(), gs_getall_surfaces(), GS_v3eq(), gsd_ortho_wall(), gsdrape_get_allsegments(), MAX_SURFS, norm, tmp, X, g_surf::x_trans, Y, g_surf::y_trans, Z, and g_surf::z_trans.

Referenced by gsd_draw_cplane_fence().

◆ transpoint_is_masked()

static int transpoint_is_masked ( geosurf surf,
Point3  point 
)
static

ADD.

Parameters
surfsurface (geosurf)
point
Returns

Definition at line 1233 of file gsd_surf.c.

References gs_point_is_masked(), X, g_surf::x_trans, Y, and g_surf::y_trans.

Referenced by get_point_below(), and gsd_ortho_wall().

Variable Documentation

◆ FCmode

int FCmode
static

Definition at line 58 of file gsd_surf.c.

Referenced by gsd_getfc(), gsd_ortho_wall(), gsd_setfc(), and gsd_wall().