Remove commented-out CoverPolygon().

This commit is contained in:
Yury Melnichek 2011-04-24 16:53:32 +02:00 committed by Alex Zolotarev
parent ac31ed145a
commit 830281b9ee

View file

@ -219,78 +219,3 @@ inline void CoverRect(CoordT minX, CoordT minY,
ASSERT_LESS_OR_EQUAL(result.size(), cells_count, (minX, minY, maxX, maxY));
cells.insert(cells.end(), result.begin(), result.end());
}
/*
template <typename BoundsT, typename CellIdT>
inline void CoverPolygon(vector<CoordPointT> const & polyLine, size_t cellDepth,
vector<CellIdT> & cells)
{
CoverPolyLine<BoundsT>(polyLine, cellDepth, cells);
if (cells.size() < 8)
return;
CellIdT minX = CellX(cells[0]), minY = CellY(cells[0]),
maxX = CellX(cells[0]), maxY = CellY(cells[0]);
for (size_t i = 1; i < cells.size(); ++i)
{
CellIdT cellX = CellX(cells[i]);
CellIdT cellY = CellY(cells[i]);
if (cellX.m_V < minX.m_V) minX.m_V = cellX.m_V;
if (cellY.m_V < minY.m_V) minY.m_V = cellY.m_V;
if (cellX.m_V > maxX.m_V) maxX.m_V = cellX.m_V;
if (cellY.m_V > maxY.m_V) maxY.m_V = cellY.m_V;
}
vector< vector<bool> > covered;
covered.resize(static_cast<size_t>(maxY.m_V - minY.m_V + 3));
for (size_t i = 0; i < covered.size(); ++i)
{
covered[i].resize(static_cast<size_t>(maxX.m_V - minX.m_V + 3));
}
vector< vector<bool> > outer = covered;
for (size_t i = 0; i < cells.size(); ++i)
{
size_t offsetX = static_cast<size_t>(CellX(cells[i]).m_V - minX.m_V + 1);
size_t offsetY = static_cast<size_t>(CellY(cells[i]).m_V - minY.m_V + 1);
covered[offsetY][offsetX] = true;
}
queue< pair<size_t, size_t> > flood;
size_t outerY = outer.size();
size_t outerX = outer[0].size();
flood.push(make_pair(0, 0));
while (!flood.empty())
{
size_t i = flood.front().first;
size_t j = flood.front().second;
flood.pop();
outer[i][j] = true;
if ((j > 0) && (!outer[i][j - 1]) && (!covered[i][j - 1]))
flood.push(make_pair(i, j - 1));
if ((i > 0) && (!outer[i - 1][j]) && (!covered[i - 1][j]))
flood.push(make_pair(i - 1, j));
if ((j < outerX - 1) && (!outer[i][j + 1]) && (!covered[i][j + 1]))
flood.push(make_pair(i, j + 1));
if ((i < outerY - 1) && (!outer[i + 1][j]) && (!covered[i + 1][j]))
flood.push(make_pair(i + 1, j));
}
cells.clear();
for (size_t i = 0; i < outer.size(); ++i)
{
for (size_t j = 0; j < outer[i].size(); ++j)
{
if (!outer[i][j])
{
cells.push_back(CellFromCellXY(cellDepth, minX.m_V + j - 1, minY.m_V + i - 1));
}
}
}
}
*/