Compare commits
No commits in common. "ade947d219754ee7c6a0a7e15ec08bc0c9ff4930" and "872cd6c4525fbe9fd190b0bd8a4cc8e5ab148728" have entirely different histories.
ade947d219
...
872cd6c452
@ -265,6 +265,8 @@ void Display::update ()
|
|||||||
m_points.erase(m_points.begin() + i);
|
m_points.erase(m_points.begin() + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//setCurrentLine(); // set current line in next step
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -307,6 +309,10 @@ void Display::update ()
|
|||||||
|
|
||||||
m_lines.push_back(Line(Point(left.x, left.y), Point(right.x, right.y)));
|
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"
|
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)
|
else if (curStep == 2)
|
||||||
@ -451,11 +457,10 @@ void Display::render (sf::RenderWindow &window)
|
|||||||
// draw already calculated hull points
|
// draw already calculated hull points
|
||||||
std::sort(m_hullPoints.begin(), m_hullPoints.end(), less); // sort clockwise
|
std::sort(m_hullPoints.begin(), m_hullPoints.end(), less); // sort clockwise
|
||||||
|
|
||||||
size_t points = m_points.size();
|
|
||||||
size_t elements = m_hullPoints.size();
|
size_t elements = m_hullPoints.size();
|
||||||
for (size_t i = 0; i < elements; ++i)
|
for (size_t i = 0; i < elements; ++i)
|
||||||
{
|
{
|
||||||
if (points > 0 || m_curLineIdx != -1) window.draw(m_hullPoints[i]);
|
window.draw(m_hullPoints[i]);
|
||||||
|
|
||||||
sf::Vertex ptTo;
|
sf::Vertex ptTo;
|
||||||
if (i < elements - 1) ptTo = sf::Vertex(m_hullPoints[i + 1].getPosition(), sf::Color::Blue);
|
if (i < elements - 1) ptTo = sf::Vertex(m_hullPoints[i + 1].getPosition(), sf::Color::Blue);
|
||||||
|
@ -94,15 +94,6 @@ public:
|
|||||||
{
|
{
|
||||||
x = (i%2 == 0) ? OFFSET : WIDTH - OFFSET;
|
x = (i%2 == 0) ? OFFSET : WIDTH - OFFSET;
|
||||||
y = diff/2 + (i/2) * diff;
|
y = diff/2 + (i/2) * diff;
|
||||||
/*if (i % 4 == 0)
|
|
||||||
{
|
|
||||||
x = OFFSET;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = (i % 4) * WIDTH / 4;
|
|
||||||
}
|
|
||||||
y = diff / 4 + (i / 4) * diff;*/
|
|
||||||
|
|
||||||
points.push_back(Point(x, y));
|
points.push_back(Point(x, y));
|
||||||
}
|
}
|
||||||
@ -138,8 +129,8 @@ public:
|
|||||||
for (int i = 0; i < valCount; ++i)
|
for (int i = 0; i < valCount; ++i)
|
||||||
{
|
{
|
||||||
x = OFFSET + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / (std::min(WIDTH, HEIGHT) - 2 * OFFSET)));
|
x = OFFSET + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / (std::min(WIDTH, HEIGHT) - 2 * OFFSET)));
|
||||||
points.push_back(Point(x, HEIGHT - x)); // ascending
|
points.push_back(Point(x, HEIGHT - x)); // /
|
||||||
//points.push_back(Point(x, HEIGHT - x)); // descending
|
//points.push_back(Point(x, HEIGHT - x)); // \
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user