GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
interp.c
Go to the documentation of this file.
1 
2 #include <grass/gis.h>
3 
4 DCELL G_interp_linear(double u, DCELL c0, DCELL c1)
5 {
6  return u * (c1 - c0) + c0;
7 }
8 
9 DCELL G_interp_bilinear(double u, double v,
10  DCELL c00, DCELL c01, DCELL c10, DCELL c11)
11 {
12  DCELL c0 = G_interp_linear(u, c00, c01);
13  DCELL c1 = G_interp_linear(u, c10, c11);
14 
15  return G_interp_linear(v, c0, c1);
16 }
17 
18 DCELL G_interp_cubic(double u, DCELL c0, DCELL c1, DCELL c2, DCELL c3)
19 {
20  return (u * (u * (u * (c3 - 3 * c2 + 3 * c1 - c0) +
21  (-c3 + 4 * c2 - 5 * c1 + 2 * c0)) + (c2 - c0)) + 2 * c1) / 2;
22 }
23 
24 DCELL G_interp_bicubic(double u, double v,
25  DCELL c00, DCELL c01, DCELL c02, DCELL c03,
26  DCELL c10, DCELL c11, DCELL c12, DCELL c13,
27  DCELL c20, DCELL c21, DCELL c22, DCELL c23,
28  DCELL c30, DCELL c31, DCELL c32, DCELL c33)
29 {
30  DCELL c0 = G_interp_cubic(u, c00, c01, c02, c03);
31  DCELL c1 = G_interp_cubic(u, c10, c11, c12, c13);
32  DCELL c2 = G_interp_cubic(u, c20, c21, c22, c23);
33  DCELL c3 = G_interp_cubic(u, c30, c31, c32, c33);
34 
35  return G_interp_cubic(v, c0, c1, c2, c3);
36 }
DCELL G_interp_bicubic(double u, double v, DCELL c00, DCELL c01, DCELL c02, DCELL c03, DCELL c10, DCELL c11, DCELL c12, DCELL c13, DCELL c20, DCELL c21, DCELL c22, DCELL c23, DCELL c30, DCELL c31, DCELL c32, DCELL c33)
Definition: interp.c:24
DCELL G_interp_cubic(double u, DCELL c0, DCELL c1, DCELL c2, DCELL c3)
Definition: interp.c:18
DCELL G_interp_linear(double u, DCELL c0, DCELL c1)
Definition: interp.c:4
DCELL G_interp_bilinear(double u, double v, DCELL c00, DCELL c01, DCELL c10, DCELL c11)
Definition: interp.c:9