From ade947d219754ee7c6a0a7e15ec08bc0c9ff4930 Mon Sep 17 00:00:00 2001 From: incredibleLeitman Date: Mon, 30 Nov 2020 19:57:56 +0100 Subject: [PATCH] select curLine in next step, only drawing lines for resulting hull --- Display.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Display.cpp b/Display.cpp index 67c4278..eb1553b 100644 --- a/Display.cpp +++ b/Display.cpp @@ -265,8 +265,6 @@ void Display::update () m_points.erase(m_points.begin() + i); } } - - //setCurrentLine(); // set current line in next step } else { @@ -309,10 +307,6 @@ void Display::update () m_lines.push_back(Line(Point(left.x, left.y), Point(right.x, right.y))); m_lines.push_back(Line(Point(right.x, right.y), Point(left.x, left.y))); // add first line in both directions to work with "right side" - - // set current line just by taking the only one (in one direction) - m_curLineIdx = 1; - m_curLine = m_lines[1]; } } else if (curStep == 2) @@ -457,10 +451,11 @@ void Display::render (sf::RenderWindow &window) // draw already calculated hull points std::sort(m_hullPoints.begin(), m_hullPoints.end(), less); // sort clockwise + size_t points = m_points.size(); size_t elements = m_hullPoints.size(); for (size_t i = 0; i < elements; ++i) { - window.draw(m_hullPoints[i]); + if (points > 0 || m_curLineIdx != -1) window.draw(m_hullPoints[i]); sf::Vertex ptTo; if (i < elements - 1) ptTo = sf::Vertex(m_hullPoints[i + 1].getPosition(), sf::Color::Blue);