GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
gsdiff.c
Go to the documentation of this file.
1 
30 #include <grass/gstypes.h>
31 #include "gsget.h"
32 
33 static geosurf *Refsurf = NULL;
34 static typbuff *Refbuff = NULL;
35 static float Refscale = 1.0;
36 
42 void gsdiff_set_SDscale(float scale)
43 {
44  Refscale = scale;
45 
46  return;
47 }
48 
54 float gsdiff_get_SDscale(void)
55 {
56  return (Refscale);
57 }
58 
64 void gsdiff_set_SDref(geosurf * gsref)
65 {
66  Refsurf = gsref;
67  Refbuff = gs_get_att_typbuff(gsref, ATT_TOPO, 0);
68 
69  return;
70 }
71 
77 geosurf *gsdiff_get_SDref(void)
78 {
79  if (Refsurf && Refbuff) {
80  return (Refsurf);
81  }
82 
83  return (NULL);
84 }
85 
94 float gsdiff_do_SD(float val, int offset)
95 {
96  float ref;
97 
98  if (Refbuff) {
99  GET_MAPATT(Refbuff, offset, ref);
100  return (ref + (val - ref) * Refscale);
101  }
102 
103  return (val);
104 }