Skip to content

Commit

Permalink
refs #24: fixed black snails on edge
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaswagner committed Jun 9, 2018
1 parent 11f1061 commit 3569c46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/algorithms/voronoi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ QImage* Voronoi::createMosaic(const QImage& input, int maxNumOfMolluscs)

auto box = calculateBoundingBox(site);

if (box.centerX < 0 || box.centerX >= width || box.centerY < 0 || box.centerY >= height)
{
continue;
}

positions.push_back(MolluscPosition{ (int)std::round(box.centerX), (int)std::round(box.centerY), (int)box.width, (int)box.height, box.rotation });

#ifdef VORONOI_USE_FLOODFILL
Expand All @@ -73,7 +78,7 @@ QImage* Voronoi::createMosaic(const QImage& input, int maxNumOfMolluscs)
result->fill(Qt::GlobalColor::white);
QPainter painter(result);

for (auto i = 0; i < diagram.numsites; ++i)
for (auto i = 0; i < positions.size(); ++i)
{
auto pos = positions[i];

Expand Down

0 comments on commit 3569c46

Please sign in to comment.