Compare commits

..

No commits in common. "f65041c0ad50ab833ba7e90d9264d8be945b0e19" and "2b299060f9ce9bae1eb27eada9aabb540221ad7a" have entirely different histories.

2 changed files with 7 additions and 21 deletions

View File

@ -127,23 +127,15 @@ void Display::setCurrentLine()
positives++; positives++;
break; // sufficient as candidate if at least one point is right break; // sufficient as candidate if at least one point is right
} }
/*if (sign(pt.getPosition().x, pt.getPosition().y, /*positives += (sign(pt.getPosition().x, pt.getPosition().y,
cand.from().x(), cand.from().y(), cand.from().x(), cand.from().y(),
cand.to().x(), cand.to().y()) > 0) cand.to().x(), cand.to().y()) > 0) ? 1 : 0;*/
{
positives++;
break; // sufficient as candidate if at least one point is right
}*/
} }
if (positives > 0) if (positives > 0)
{ {
m_curLineIdx = lines - 1; m_curLineIdx = lines - 1;
m_curLine = m_lines[lines - 1]; m_curLine = m_lines[lines - 1];
std::cout << "selecting last line of " << lines << ": " <<
m_curLine.from().x() << ", " << m_curLine.from().y() << " - " <<
m_curLine.to().x() << ", " << m_curLine.to().y() << std::endl;
} }
else else
{ {
@ -217,11 +209,6 @@ void Display::update ()
} }
} }
std::cout << "right: " << right.x << ", " << right.y << std::endl;
std::cout << "top: " << top.x << ", " << top.y << std::endl;
std::cout << "left: " << left.x << ", " << left.y << std::endl;
std::cout << "bot: " << bot.x << ", " << bot.y << std::endl;
// adding edge points to hull // adding edge points to hull
m_points[i_left].setFillColor(sf::Color::Blue); m_points[i_left].setFillColor(sf::Color::Blue);
m_hullPoints.push_back(m_points[i_left]); m_hullPoints.push_back(m_points[i_left]);
@ -236,11 +223,9 @@ void Display::update ()
m_hullPoints.push_back(m_points[i_bot]); m_hullPoints.push_back(m_points[i_bot]);
// building lines between edge points // building lines between edge points
// hull points shall be clockwise, but lines have to be counterclockwise Point pt1(left.x, left.y);
// because only checking elems right of lines
Point pt1(right.x, right.y);
Point pt2(top.x, top.y); Point pt2(top.x, top.y);
Point pt3(left.x, left.y); Point pt3(right.x, right.y);
Point pt4(bot.x, bot.y); Point pt4(bot.x, bot.y);
m_lines.push_back(Line(pt1, pt2)); m_lines.push_back(Line(pt1, pt2));
m_lines.push_back(Line(pt2, pt3)); m_lines.push_back(Line(pt2, pt3));
@ -266,7 +251,7 @@ void Display::update ()
} }
} }
//setCurrentLine(); // set current line in next step setCurrentLine();
} }
else else
{ {

View File

@ -105,6 +105,7 @@ public:
{ {
points_left.emplace_back(point); points_left.emplace_back(point);
} }
} }
// Call get_hull_with_line with the left points, as well as with the right points, and the line // Call get_hull_with_line with the left points, as well as with the right points, and the line