diff --git a/Quickhull.h b/Quickhull.h index 0eb37eb..3490842 100644 --- a/Quickhull.h +++ b/Quickhull.h @@ -3,6 +3,8 @@ #include #include +#include +#include #include "Display.h" #include "Triangle.h" @@ -12,6 +14,8 @@ class Quickhull public: static void get_hull(std::list &input, std::list &output, bool akl) { + auto start = std::chrono::high_resolution_clock::now(); + // Get leftmost and rightmost point Point leftmost(INFINITY, 0.0), rightmost(-INFINITY, 0.0); @@ -52,9 +56,12 @@ public: // Call get_hull_with_line with the left points, as well as with the right points, and the line get_hull_with_line(points_left, output, line); get_hull_with_line(points_right, output, line); + + auto diff = std::chrono::duration(std::chrono::high_resolution_clock::now() - start); + std::cout << "-- inner diff: " << diff.count() << "ms" << std::endl; } - static void show (std::list points, std::list& hull) + static void show (std::list &points, std::list& hull) { // showing points in window after calculation // create the window diff --git a/main.cpp b/main.cpp index b3a7206..6d8ec9a 100644 --- a/main.cpp +++ b/main.cpp @@ -102,7 +102,7 @@ int main (int argc, char **argv) // --------------------------------------------------------------- // TODO: remove, just for comparison auto diff2 = std::chrono::duration(std::chrono::high_resolution_clock::now() - start2); - std::cout << "average time2 spent: " << diff2.count() << "ms" << std::endl; + std::cout << "total time spent: " << diff2.count() << "ms" << std::endl; // --------------------------------------------------------------- std::cout << "average time spent: " << total.count()/runs << "ms" << std::endl; Quickhull::show(points, hull);