Calculate the weights corresponding to the points in the output grid. Weights are calculated by bi-linear interpolation. For interpolation, the triangle which contains the point and has the smallest radius is searched. If this is not available in case of extrapolation, the condition is relaxed and requires only the circle to contain the point. If such circle is not available, the circle with the closest center is chosen.
Definition at line 172 of file Interpolator2D.h.
References Interpolator2D::weight::c, Interpolator2D::weight::w, Interpolator2D::vec::x, and Interpolator2D::vec::y.
Referenced by SetOutputGrid().
179 double mindd = DBL_MAX;
188 if (ic->isInsideTriangle(*ip))
190 if (mint==
circles.cend() || ic->r<mint->r)
199 const double dd = ic->dist(*ip);
202 if (minc==
circles.cend() || ic->r<minc->r)
219 const auto it = mint==
circles.cend() ? (minc==
circles.cend() ? mind : minc) : mint;
224 const vec &p1 = it->p[0];
225 const vec &p2 = it->p[1];
226 const vec &p3 = it->p[2];
228 const double dy23 = p2.y - p3.y;
229 const double dy31 = p3.y - p1.y;
230 const double dy12 = p1.y - p2.y;
232 const double dx32 = p3.x - p2.x;
233 const double dx13 = p1.x - p3.x;
234 const double dx21 = p2.x - p1.x;
236 const double dxy23 = p2^p3;
237 const double dxy31 = p3^p1;
238 const double dxy12 = p1^p2;
240 const double det = dxy12 + dxy23 + dxy31;
242 const double w1 = (dy23*ip->x + dx32*ip->y + dxy23)/det;
243 const double w2 = (dy31*ip->x + dx13*ip->y + dxy31)/det;
244 const double w3 = (dy12*ip->x + dx21*ip->y + dxy12)/det;
std::vector< point > outputGrid
positions of the data points (e.g. sensors)
std::vector< circle > circles
positions at which inter-/extrapolated values should be provided
std::vector< weight > weights
the calculated circles/triangles