std::vector<Point> points;
66 explicit Convexhull(
conststd::vector<Point> &pointList) {
80std::vector<Point> hull;
83 intleftmost_point = 0;
84 for(
inti = 1; i < size; i++) {
85 if(points[i].x < points[leftmost_point].x) {
92 intp = leftmost_point, q = 0;
95hull.push_back(points[p]);
103 for(
inti = 0; i < size; i++) {
106 if(
orientation(points[p], points[i], points[q]) == 2) {
116}
while(p != leftmost_point);
134 intval = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
139 return(val > 0) ? 1 : 2;
152std::vector<geometry::jarvis::Point> points = {{0, 3},
161std::vector<geometry::jarvis::Point> actualPoint;
164std::vector<geometry::jarvis::Point> expectedPoint = {{0, 3},
168 for(
inti = 0; i < expectedPoint.size(); i++) {
169assert(actualPoint[i].x == expectedPoint[i].x);
170assert(actualPoint[i].y == expectedPoint[i].y);
172std::cout <<
"Test implementations passed!\n";
static int orientation(const Point &p, const Point &q, const Point &r)
Convexhull(const std::vector< Point > &pointList)
std::vector< Point > getConvexHull() const
Functions for Jarvis’s algorithm.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4