adding temp debug output to show slowdown -> TODO: revert this commit
This commit is contained in:
parent
ce7e9fa015
commit
482a9eb30e
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "Triangle.h"
|
#include "Triangle.h"
|
||||||
@ -12,6 +14,8 @@ class Quickhull
|
|||||||
public:
|
public:
|
||||||
static void get_hull(std::list<Point> &input, std::list<Point> &output, bool akl)
|
static void get_hull(std::list<Point> &input, std::list<Point> &output, bool akl)
|
||||||
{
|
{
|
||||||
|
auto start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
// Get leftmost and rightmost point
|
// Get leftmost and rightmost point
|
||||||
Point leftmost(INFINITY, 0.0), rightmost(-INFINITY, 0.0);
|
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
|
// 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_left, output, line);
|
||||||
get_hull_with_line(points_right, output, line);
|
get_hull_with_line(points_right, output, line);
|
||||||
|
|
||||||
|
auto diff = std::chrono::duration<double, std::milli>(std::chrono::high_resolution_clock::now() - start);
|
||||||
|
std::cout << "-- inner diff: " << diff.count() << "ms" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show (std::list<Point> points, std::list<Point>& hull)
|
static void show (std::list<Point> &points, std::list<Point>& hull)
|
||||||
{
|
{
|
||||||
// showing points in window after calculation
|
// showing points in window after calculation
|
||||||
// create the window
|
// create the window
|
||||||
|
2
main.cpp
2
main.cpp
@ -102,7 +102,7 @@ int main (int argc, char **argv)
|
|||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// TODO: remove, just for comparison
|
// TODO: remove, just for comparison
|
||||||
auto diff2 = std::chrono::duration<double, std::milli>(std::chrono::high_resolution_clock::now() - start2);
|
auto diff2 = std::chrono::duration<double, std::milli>(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;
|
std::cout << "average time spent: " << total.count()/runs << "ms" << std::endl;
|
||||||
Quickhull::show(points, hull);
|
Quickhull::show(points, hull);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user