Fix/tabulated2dfunction
There are two issues. First, we have m * n points, so (m-1) * (n - 1) intervals. The existing iToX and jToY functions are written in accordance. However, xToI and jToY do not match. They assume that there are m*n intervals. That needs to be fixed.
The second issue is the following code in get():
int i = max(0, min(m_, static_cast<int>(alpha)));
int j = max(0, min(n_, static_cast<int>(beta)));
With x == xMax, alpha will be as big as (m_- 1) even after the proposed fix to xToI. But we need an interval number here, not a point number, and there is no (m_- 1)-th interval (not to mention _m-th). So we need to cut i at (m_ - 2). Similarly with j.
Without the fix, the assertions in getSamplePoint
assert(0 <= i && i < m_);
assert(0 <= j && j < n_);
rightfully fail when x is close to xMax or y is close to yMax.
TODO:
-
Check which tests are affected
Edited by Timo Koch