GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
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

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 UNUSED, int(*user_func)(void) UNUSED)
 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...
 

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 42 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 *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
Definition: gs.c:968
#define X
Definition: ogsf.h:140
#define Y
Definition: ogsf.h:141
#define XY2OFF(gs, px, py)
Definition: rowcol.h:24

MACROS for use in gsd_ortho_wall ONLY !!!

Definition at line 47 of file gsd_surf.c.

Function Documentation

◆ gsd_getfc()

int gsd_getfc ( void  )

ADD.

Returns

Definition at line 1217 of file gsd_surf.c.

Referenced by GS_get_fencecolor(), and GS_transp_is_set().

◆ gsd_norm_arrows()

int gsd_norm_arrows ( geosurf surf)

ADD.

Need to do Zexag scale of normal for arrow direction, drawing routine unexags z for arrow

Parameters
surfsurface (geosurf)
Returns

Definition at line 1805 of file gsd_surf.c.

Referenced by gsd_surf().

◆ gsd_ortho_wall()

int gsd_ortho_wall ( int  np,
int  ns,
geosurf **  gsurfs,
Point3 **  points,
float *  norm 
)

ADD.

Parameters
np
ns
gsurfs
points
norm
Returns

Definition at line 1323 of file gsd_surf.c.

◆ gsd_setfc()

void gsd_setfc ( int  mode)

ADD.

Parameters
mode

Definition at line 1205 of file gsd_surf.c.

◆ gsd_surf()

int gsd_surf ( geosurf surf)

◆ gsd_surf_const()

int gsd_surf_const ( geosurf surf,
float  k 
)

Using tmesh - not confident with qstrips portability.

Todo:
FIX: do_diff won't work right - needs normals - maybe calculate on the fly
Parameters
surfsurface (geosurf)
k
Returns

Definition at line 729 of file gsd_surf.c.

Referenced by gsd_surf().

◆ gsd_surf_func()

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

Define user function.

Not yet supported

Parameters
gssurface (geosurf) [unused]
user_funcuser function [unused]
Returns
1

Definition at line 1090 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 2061 of file gsd_surf.c.

Referenced by gsd_surf().

◆ gsd_surf_map_old()

int gsd_surf_map_old ( geosurf surf)

ADD.

Using tmesh - not confident with qstrips portability

Parameters
surfsurface (geosurf)
Returns

Definition at line 139 of file gsd_surf.c.

◆ 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 1109 of file gsd_surf.c.

◆ 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 1710 of file gsd_surf.c.