1 /* gennorm.c                                                    */
2 #include <math.h>
3 #include <grass/gis.h>
4 #include "ransurf.h"
5 
GenNorm(void)6 void GenNorm(void)
7 {
8     double t, b, c, sqr;
9     int i;
10 
11     G_debug(2, "GenNorm()");
12 
13     Norm = (double *)G_malloc(SIZE_OF_DISTRIBUTION * sizeof(double));
14     sqr = 1 / sqrt(2 * PI);
15     c = 0.0;
16     for (i = 0; i < SIZE_OF_DISTRIBUTION; i++) {
17 	t = ((double)(i - SIZE_OF_DISTRIBUTION / 2)) * DELTA_T;
18 	b = exp(-t * t / 2.0) * sqr * DELTA_T;
19 	c = c + b;
20 	G_debug(3, "(c):%.12lf", c);
21 	Norm[i] = c;
22     }
23 
24     return;
25 }
26