void HexGrid::markNeighborBelow(Hexagon *h) { Coord c = h->neighborCoord(3); Hexagon *neighbor = getHexagon(c); neighbor->setDenseNeighbor(0); if (neighbor->dense() && !neighbor->possibleRoot()) m_pos_roots.erase(neighbor); }
// A debugging function that can be used to make a particular hexagon // dense. void HexGrid::addDenseHexagon(int x, int y) { Hexagon *h = getHexagon(x, y); if (!h->dense()) { h->setCount(m_dense_limit); h->setDense(); m_miny = std::min(m_miny, h->y() - 1); if (h->possibleRoot()) m_pos_roots.insert(h); markNeighborBelow(h); } }
void HexGrid::addPoint(Point p) { Hexagon *h = findHexagon(p); if (!h->dense()) { h->increment(); if (dense(h)) { h->setDense(); m_miny = std::min(m_miny, h->y() - 1); if (h->possibleRoot()) { m_pos_roots.insert(h); } markNeighborBelow(h); } } }
void HexGrid::addPoint(Point p) { if (m_width < 0) { m_sample.push_back(p); if (m_sample.size() >= m_maxSample) processSample(); return; } Hexagon *h = findHexagon(p); h->increment(); if (!h->dense()) { if (dense(h)) { h->setDense(); m_miny = std::min(m_miny, h->y() - 1); if (h->possibleRoot()) m_pos_roots.insert(h); markNeighborBelow(h); } } }