1#if !defined(ISCE_UNWRAP_ICU_SEARCHTABLE_ICC)
2#error "SearchTable.icc is an implementation detail of class SearchTable."
5namespace isce3::unwrap::icu
9SearchTable::SearchTable(
11 const float ratioDxDy)
14 const int w = 2 * maxdist + 1;
16 _searchpts =
new offset2_t[w*w];
17 _npts =
new size_t[maxdist+1];
20 float ratioSqx, ratioSqy;
23 ratioSqx = ratioDxDy * ratioDxDy;
29 ratioSqy = 1.f / (ratioDxDy * ratioDxDy);
34 auto distSq =
new float[w*w];
35 for (
int y = -maxdist; y <= maxdist; ++y)
37 for (
int x = -maxdist; x <= maxdist; ++x)
39 size_t i = (y + maxdist) * w + (x + maxdist);
40 distSq[i] = ratioSqy * float(y*y) + ratioSqx * float(x*x);
45 auto visited =
new bool[w*w];
46 for (
size_t i = 0; i < w*w; ++i) { visited[i] =
false; }
47 visited[maxdist * w + maxdist] =
true;
53 for (
int d = 1; d <= maxdist; ++d)
55 float dSq = float(d*d);
57 for (
int y = -d; y <= d; ++y)
59 for (
int x = -d; x <= d; ++x)
61 size_t i = (y + maxdist) * w + (x + maxdist);
62 if (distSq[i] <= dSq && !visited[i])
64 _searchpts[n] = {x, y};
79SearchTable::~SearchTable()
86offset2_t & SearchTable::operator[](
87 const size_t pos)
const
89 return _searchpts[pos];
93size_t SearchTable::numPtsInEllipse(