A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d4/d8d/jarvis__algorithm_8cpp_source.html below:

TheAlgorithms/C++: geometry/jarvis_algorithm.cpp Source File

Go to the documentation of this file. 56

std::vector<Point> points;

66 explicit Convexhull

(

const

std::vector<Point> &pointList) {

80

std::vector<Point> hull;

83 int

leftmost_point = 0;

84 for

(

int

i = 1; i < size; i++) {

85 if

(points[i].x < points[leftmost_point].x) {

92 int

p = leftmost_point, q = 0;

95

hull.push_back(points[p]);

103 for

(

int

i = 0; i < size; i++) {

106 if

(

orientation

(points[p], points[i], points[q]) == 2) {

116

}

while

(p != leftmost_point);

134 int

val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);

139 return

(val > 0) ? 1 : 2;

152

std::vector<geometry::jarvis::Point> points = {{0, 3},

161

std::vector<geometry::jarvis::Point> actualPoint;

164

std::vector<geometry::jarvis::Point> expectedPoint = {{0, 3},

168 for

(

int

i = 0; i < expectedPoint.size(); i++) {

169

assert(actualPoint[i].x == expectedPoint[i].x);

170

assert(actualPoint[i].y == expectedPoint[i].y);

172

std::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