Skip to content

Commit 522d94d

Browse files
committed
Rename Cell struct to cell_t
1 parent 3db46e9 commit 522d94d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/geom-pole-of-inaccessibility.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,28 +116,29 @@ auto point_to_polygon_distance(point_t point, polygon_t const &polygon,
116116
return (inside ? 1 : -1) * std::sqrt(min_dist_squared);
117117
}
118118

119-
struct Cell
119+
struct cell_t
120120
{
121121
static constexpr double SQRT2 = 1.4142135623730951;
122122

123-
Cell(point_t c, double h, polygon_t const &polygon, double stretch)
123+
cell_t(point_t c, double h, polygon_t const &polygon, double stretch)
124124
: center(c), half_size(h),
125125
dist(point_to_polygon_distance(center, polygon, stretch)),
126126
max(dist + half_size * SQRT2)
127-
{}
127+
{
128+
}
128129

129130
point_t center; // cell center
130131
double half_size; // half the cell size
131132
double dist; // distance from cell center to polygon
132133
double max; // max distance to polygon within a cell
133134

134-
friend bool operator<(Cell const &a, Cell const &b) noexcept
135+
friend bool operator<(cell_t const &a, cell_t const &b) noexcept
135136
{
136137
return a.max < b.max;
137138
}
138139
};
139140

140-
Cell make_centroid_cell(polygon_t const &polygon, double stretch)
141+
cell_t make_centroid_cell(polygon_t const &polygon, double stretch)
141142
{
142143
point_t centroid{0, 0};
143144
boost::geometry::centroid(polygon, centroid);
@@ -166,7 +167,7 @@ point_t pole_of_inaccessibility(polygon_t const &polygon, double precision,
166167
return envelope.min();
167168
}
168169

169-
std::priority_queue<Cell, std::vector<Cell>> cell_queue;
170+
std::priority_queue<cell_t, std::vector<cell_t>> cell_queue;
170171

171172
// cover polygon with initial cells
172173
if (stretched_envelope.width() == stretched_envelope.height()) {
@@ -201,7 +202,7 @@ point_t pole_of_inaccessibility(polygon_t const &polygon, double precision,
201202
auto best_cell = make_centroid_cell(polygon, stretch);
202203

203204
// second guess: bounding box centroid
204-
Cell const bbox_cell{stretched_envelope.center(), 0, polygon, stretch};
205+
cell_t const bbox_cell{stretched_envelope.center(), 0, polygon, stretch};
205206
if (bbox_cell.dist > best_cell.dist) {
206207
best_cell = bbox_cell;
207208
}
@@ -227,8 +228,8 @@ point_t pole_of_inaccessibility(polygon_t const &polygon, double precision,
227228

228229
for (auto const dy : {-h, h}) {
229230
for (auto const dx : {-h, h}) {
230-
Cell const c{point_t{center.x() + dx, center.y() + dy}, h,
231-
polygon, stretch};
231+
cell_t const c{point_t{center.x() + dx, center.y() + dy}, h,
232+
polygon, stretch};
232233
if (c.max > best_cell.dist) {
233234
cell_queue.push(c);
234235
}

0 commit comments

Comments
 (0)