Compare commits
2 Commits
2b299060f9
...
f65041c0ad
Author | SHA1 | Date | |
---|---|---|---|
f65041c0ad | |||
40f6a6cb04 |
27
Display.cpp
27
Display.cpp
@ -127,15 +127,23 @@ void Display::setCurrentLine()
|
||||
positives++;
|
||||
break; // sufficient as candidate if at least one point is right
|
||||
}
|
||||
/*positives += (sign(pt.getPosition().x, pt.getPosition().y,
|
||||
cand.from().x(), cand.from().y(),
|
||||
cand.to().x(), cand.to().y()) > 0) ? 1 : 0;*/
|
||||
/*if (sign(pt.getPosition().x, pt.getPosition().y,
|
||||
cand.from().x(), cand.from().y(),
|
||||
cand.to().x(), cand.to().y()) > 0)
|
||||
{
|
||||
positives++;
|
||||
break; // sufficient as candidate if at least one point is right
|
||||
}*/
|
||||
}
|
||||
|
||||
if (positives > 0)
|
||||
{
|
||||
m_curLineIdx = 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
|
||||
{
|
||||
@ -209,6 +217,11 @@ 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
|
||||
m_points[i_left].setFillColor(sf::Color::Blue);
|
||||
m_hullPoints.push_back(m_points[i_left]);
|
||||
@ -223,9 +236,11 @@ void Display::update ()
|
||||
m_hullPoints.push_back(m_points[i_bot]);
|
||||
|
||||
// building lines between edge points
|
||||
Point pt1(left.x, left.y);
|
||||
// hull points shall be clockwise, but lines have to be counterclockwise
|
||||
// because only checking elems right of lines
|
||||
Point pt1(right.x, right.y);
|
||||
Point pt2(top.x, top.y);
|
||||
Point pt3(right.x, right.y);
|
||||
Point pt3(left.x, left.y);
|
||||
Point pt4(bot.x, bot.y);
|
||||
m_lines.push_back(Line(pt1, pt2));
|
||||
m_lines.push_back(Line(pt2, pt3));
|
||||
@ -251,7 +266,7 @@ void Display::update ()
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentLine();
|
||||
//setCurrentLine(); // set current line in next step
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,7 +105,6 @@ public:
|
||||
{
|
||||
points_left.emplace_back(point);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Call get_hull_with_line with the left points, as well as with the right points, and the line
|
||||
|
Loading…
x
Reference in New Issue
Block a user