MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / cmp_points

Function cmp_points

contents/graham_scan/code/c/graham.c:11–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9};
10
11int cmp_points(const void *a, const void *b) {
12 struct point* pa = (struct point*) a;
13 struct point* pb = (struct point*) b;
14
15 if (pa->y > pb->y) {
16 return 1;
17 } else if (pa->y < pb->y) {
18 return -1;
19 } else {
20 return 0;
21 }
22}
23
24double ccw(struct point a, struct point b, struct point c) {
25 return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected