MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / equal_cycles

Function equal_cycles

test/test_planar_faces.cpp:7–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "planar.h"
6
7bool equal_cycles(const std::vector<size_t> & a, const std::vector<size_t> & b) {
8 size_t n = a.size();
9 if (n != b.size()) {
10 return false;
11 }
12 for (size_t begin = 0; begin < n; begin++) {
13 bool ok = true;
14 for (size_t i = 0; i < n; i++) {
15 if (a[(begin + i) % n] != b[i]) {
16 ok = false;
17 break;
18 }
19 }
20 if (ok) {
21 return true;
22 }
23 }
24 return false;
25}
26
27void test_simple() {
28 std::vector<Point> p = {

Callers 4

test_simpleFunction · 0.85
test_degenerateFunction · 0.85
test_cycle_with_chainFunction · 0.85
test_ccw_angleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected