Add outline for Quickhull algorithm
Mostly comments for now
This commit is contained in:
parent
548f0733ee
commit
cb4d223780
2
Makefile
2
Makefile
@ -18,5 +18,7 @@ Display.o: Display.h
|
|||||||
|
|
||||||
Timing.o: Timing.h
|
Timing.o: Timing.h
|
||||||
|
|
||||||
|
Quickhull.o: Quickhull.h
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
-rm *.o quickhull
|
-rm *.o quickhull
|
||||||
|
26
Quickhull.cpp
Normal file
26
Quickhull.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
#include "Quickhull.h"
|
||||||
|
|
||||||
|
void Quickhull::get_hull(std::vector<Point> &input, std::vector<Point> &output)
|
||||||
|
{
|
||||||
|
// Get leftmost and rightmost point
|
||||||
|
// Add them to the output.
|
||||||
|
|
||||||
|
// Create a line from leftmost to rightmost
|
||||||
|
|
||||||
|
// Sort points between left and right of that line
|
||||||
|
|
||||||
|
// Call get_hull_with_line with the left points, as well as with the right points, and the line
|
||||||
|
}
|
||||||
|
|
||||||
|
void Quickhull::get_hull_with_line(std::vector<Point> &input, std::vector<Point> &output, Point, Point)
|
||||||
|
{
|
||||||
|
// If the input vector is empty, we're done
|
||||||
|
|
||||||
|
// Find the point which is furthest away from the line, add it to the output
|
||||||
|
|
||||||
|
// Build a triangle with these 3 points
|
||||||
|
// Remove points inside this triangle
|
||||||
|
|
||||||
|
// Recursively call get_hull_with_line for each side of the triangle
|
||||||
|
}
|
14
Quickhull.h
Normal file
14
Quickhull.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Point.h"
|
||||||
|
|
||||||
|
class Quickhull
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void get_hull(std::vector<Point> &, std::vector<Point> &);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void get_hull_with_line(std::vector<Point> &, std::vector<Point> &, Point, Point);
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user