quickhull/performance.cpp

56 lines
1.4 KiB
C++

#include "Quickhull.h"
#include "NumberGenerator.h"
#include "Display.h"
int main()
{
std::list<Point> points = NumberGenerator::get_circle_numbers(500);
std::list<Point> hull;
Quickhull::get_hull(points, hull);
// create the window
sf::RenderWindow window(sf::VideoMode(800, 800), "k-d-tree");
sf::CircleShape normal_p(2);
normal_p.setFillColor(sf::Color(250, 250, 250));
sf::CircleShape hull_p(2);
hull_p.setFillColor(sf::Color(250, 100, 50));
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
// clear the window with black color
window.clear(sf::Color::Black);
// Draw all points
for (const Point &point : points)
{
normal_p.setPosition(point.x() + 50, point.y() + 50);
window.draw(normal_p);
}
// Draw hull points
for (const Point &point : hull)
{
hull_p.setPosition(point.x() + 50, point.y() + 50);
window.draw(hull_p);
}
// end the current frame
window.display();
}
return 0;
}