-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHullAlgorithms.cpp
More file actions
45 lines (42 loc) · 1.07 KB
/
HullAlgorithms.cpp
File metadata and controls
45 lines (42 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @file
* @author The CS2 TA Team
* @version 1.0
* @date 2013-2014
* @copyright This code is in the public domain.
*
* @brief The gift wrapping and Graham scan convex hull algorithms
* (implementation).
*
*/
#include "HullAlgorithms.hpp"
/**
* TO STUDENTS: In all of the following functions, feel free to change the
* function arguments and/or write helper functions as you see fit. Remember to
* add the function header to HullAlgorithms.hpp if you write a helper function!
*
* Our reference implementation has four helper functions and the function(s)
* copied over from angleSort.cpp.
*/
/**
* TODO: Implement this function.
*/
void DoGiftWrap(vector<Tuple*> points, ConvexHullApp *app)
{
for (unsigned int i = 0; i < points.size(); ++i)
{
app->add_to_hull(points[i]);
}
app->add_to_hull(points[0]);
}
/**
* TODO: Implement this function.
*/
void DoGrahamScan(vector<Tuple*> points, ConvexHullApp *app)
{
for (unsigned int i = 0; i < points.size(); ++i)
{
app->add_to_hull(points[i]);
}
app->add_to_hull(points[0]);
}