#include "Quickhull.h" #include "NumberGenerator.h" #include "Display.h" int main() { std::list points = NumberGenerator::get_rectangle_numbers(100); std::list hull; auto start = std::chrono::high_resolution_clock::now(); Quickhull::get_hull(points, hull); auto diff = std::chrono::duration(std::chrono::high_resolution_clock::now() - start); std::cout << "time spent: " << diff.count() << "ms" << std::endl; // shit runs about 120 milliseconds for 1Mio numbers // 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; }