Branch Coverage

src/mapbox/earcut.hpp
Criterion Covered Total %
branch 108 298 36.2


line true false branch
101 0 2 if (currentIndex >= blockSize) {
1 7 if (currentIndex >= blockSize) {
111 1 3 for (auto allocation : allocations) alloc.deallocate(allocation, blockSize);
134 0 1 if (points.empty()) return;
141 3 0 for (size_t i = 0; threshold >= 0 && i < points.size(); i++) {
2 1 for (size_t i = 0; threshold >= 0 && i < points.size(); i++) {
2 1 for (size_t i = 0; threshold >= 0 && i < points.size(); i++) {
147 1 0 nodes.reset(len * 3 / 2);
148 1 0 indices.reserve(len + points[0].size());
150 1 0 Node* outerNode = linkedList(points[0], true);
151 0 1 if (!outerNode) return;
153 1 0 if (points.size() > 1) outerNode = eliminateHoles(points, outerNode);
1 0 if (points.size() > 1) outerNode = eliminateHoles(points, outerNode);
157 0 1 if (hashing) {
161 0 0 do {
173 0 0 inv_size = inv_size != .0 ? (1. / inv_size) : .0;
176 1 0 earcutLinked(outerNode);
178 1 0 nodes.clear();
192 2 0 for (i = 0, j = len > 0 ? len - 1 : 0; i < len; j = i++) {
8 2 for (i = 0, j = len > 0 ? len - 1 : 0; i < len; j = i++) {
203 1 1 if (clockwise == (sum > 0)) {
204 4 1 for (i = 0; i < len; i++) last = insertNode(vertices + i, points[i], last);
206 4 1 for (i = len; i-- > 0;) last = insertNode(vertices + i, points[i], last);
209 2 0 if (last && equals(last, last->next)) {
0 2 if (last && equals(last, last->next)) {
0 2 if (last && equals(last, last->next)) {
223 0 2 if (!end) end = start;
227 2 0 do {
0 2 do {
230 2 0 if (!p->steiner && (equals(p, p->next) || area(p->prev, p, p->next) == 0)) {
2 0 if (!p->steiner && (equals(p, p->next) || area(p->prev, p, p->next) == 0)) {
0 2 if (!p->steiner && (equals(p, p->next) || area(p->prev, p, p->next) == 0)) {
0 2 if (!p->steiner && (equals(p, p->next) || area(p->prev, p, p->next) == 0)) {
234 0 0 if (p == p->next) break;
248 0 1 if (!ear) return;
251 1 0 if (!pass && hashing) indexCurve(ear);
0 1 if (!pass && hashing) indexCurve(ear);
260 19 1 while (ear->prev != ear->next) {
265 0 19 if (hashing ? isEarHashed(ear) : isEar(ear)) {
8 11 if (hashing ? isEarHashed(ear) : isEar(ear)) {
283 0 11 if (ear == stop) {
285 0 0 if (!pass) earcutLinked(filterPoints(ear), 1);
288 0 0 else if (pass == 1) {
293 0 0 } else if (pass == 2) splitEarcut(ear);
307 6 13 if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
312 38 8 while (p != ear->prev) {
313 5 33 if (pointInTriangle(a->x, a->y, b->x, b->y, c->x, c->y, p->x, p->y) &&
327 0 0 if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
342 0 0 while (p && p->z <= maxZ) {
0 0 while (p && p->z <= maxZ) {
343 0 0 if (p != ear->prev && p != ear->next &&
0 0 if (p != ear->prev && p != ear->next &&
352 0 0 while (p && p->z >= minZ) {
0 0 while (p && p->z >= minZ) {
353 0 0 if (p != ear->prev && p != ear->next &&
0 0 if (p != ear->prev && p != ear->next &&
367 0 0 do {
372 0 0 if (!equals(a, b) && intersects(a, p, p->next, b) && locallyInside(a, b) && locallyInside(b, a)) {
0 0 if (!equals(a, b) && intersects(a, p, p->next, b) && locallyInside(a, b) && locallyInside(b, a)) {
0 0 if (!equals(a, b) && intersects(a, p, p->next, b) && locallyInside(a, b) && locallyInside(b, a)) {
0 0 if (!equals(a, b) && intersects(a, p, p->next, b) && locallyInside(a, b) && locallyInside(b, a)) {
0 0 if (!equals(a, b) && intersects(a, p, p->next, b) && locallyInside(a, b) && locallyInside(b, a)) {
394 0 0 do {
396 0 0 while (b != a->prev) {
397 0 0 if (a->i != b->i && isValidDiagonal(a, b)) {
0 0 if (a->i != b->i && isValidDiagonal(a, b)) {
0 0 if (a->i != b->i && isValidDiagonal(a, b)) {
423 1 1 for (size_t i = 1; i < len; i++) {
424 1 0 Node* list = linkedList(points[i], false);
425 1 0 if (list) {
426 0 1 if (list == list->next) list->steiner = true;
427 1 0 queue.push_back(getLeftmost(list));
430 1 0 std::sort(queue.begin(), queue.end(), [](const Node* a, const Node* b) {
435 1 1 for (size_t i = 0; i < queue.size(); i++) {
436 1 0 eliminateHole(queue[i], outerNode);
437 1 0 outerNode = filterPoints(outerNode, outerNode->next);
447 1 0 if (outerNode) {
465 3 1 do {
466 2 2 if (hy <= p->y && hy >= p->next->y && p->next->y != p->y) {
1 1 if (hy <= p->y && hy >= p->next->y && p->next->y != p->y) {
1 0 if (hy <= p->y && hy >= p->next->y && p->next->y != p->y) {
468 1 0 if (x <= hx && x > qx) {
1 0 if (x <= hx && x > qx) {
470 0 1 if (x == hx) {
471 0 0 if (hy == p->y) return p;
472 0 0 if (hy == p->next->y) return p->next;
474 0 1 m = p->x < p->next->x ? p : p->next;
480 0 1 if (!m) return 0;
482 0 1 if (hx == qx) return m->prev;
496 3 1 while (p != stop) {
497 1 2 if (hx >= p->x && p->x >= mx && hx != p->x &&
1 0 if (hx >= p->x && p->x >= mx && hx != p->x &&
0 3 if (hx >= p->x && p->x >= mx && hx != p->x &&
498 0 1 pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p->x, p->y)) {
0 1 pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p->x, p->y)) {
502 0 0 if ((tanCur < tanMin || (tanCur == tanMin && p->x > m->x)) && locallyInside(p, hole)) {
0 0 if ((tanCur < tanMin || (tanCur == tanMin && p->x > m->x)) && locallyInside(p, hole)) {
0 0 if ((tanCur < tanMin || (tanCur == tanMin && p->x > m->x)) && locallyInside(p, hole)) {
0 0 if ((tanCur < tanMin || (tanCur == tanMin && p->x > m->x)) && locallyInside(p, hole)) {
0 0 if ((tanCur < tanMin || (tanCur == tanMin && p->x > m->x)) && locallyInside(p, hole)) {
517 0 0 assert(start);
520 0 0 do {
521 0 0 p->z = p->z ? p->z : zOrder(p->x, p->y);
538 0 0 assert(list);
552 0 0 while (p) {
556 0 0 for (i = 0; i < inSize; i++) {
559 0 0 if (!q) break;
564 0 0 while (pSize > 0 || (qSize > 0 && q)) {
0 0 while (pSize > 0 || (qSize > 0 && q)) {
0 0 while (pSize > 0 || (qSize > 0 && q)) {
566 0 0 if (pSize == 0) {
570 0 0 } else if (qSize == 0 || !q) {
0 0 } else if (qSize == 0 || !q) {
574 0 0 } else if (p->z <= q->z) {
584 0 0 if (tail) tail->nextZ = e;
596 0 0 if (numMerges <= 1) return list;
628 3 1 do {
629 1 3 if (p->x < leftmost->x) leftmost = p;
641 19 20 (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
11 8 (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
9 2 (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
648 0 0 locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);
0 0 locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);
0 0 locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);
0 0 locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);
660 2 2 return p1->x == p2->x && p1->y == p2->y;
0 2 return p1->x == p2->x && p1->y == p2->y;
666 0 0 if ((equals(p1, q1) && equals(p2, q2)) ||
0 0 if ((equals(p1, q1) && equals(p2, q2)) ||
669 0 0 (area(p2, q2, p1) > 0) != (area(p2, q2, q1) > 0);
0 0 (area(p2, q2, p1) > 0) != (area(p2, q2, q1) > 0);
676 0 0 do {
677 0 0 if (p->i != a->i && p->next->i != a->i && p->i != b->i && p->next->i != b->i &&
0 0 if (p->i != a->i && p->next->i != a->i && p->i != b->i && p->next->i != b->i &&
0 0 if (p->i != a->i && p->next->i != a->i && p->i != b->i && p->next->i != b->i &&
0 0 if (p->i != a->i && p->next->i != a->i && p->i != b->i && p->next->i != b->i &&
690 0 0 area(a, b, a->prev) < 0 || area(a, a->next, b) < 0;
0 0 area(a, b, a->prev) < 0 || area(a, a->next, b) < 0;
700 0 0 do {
701 0 0 if (((p->y > py) != (p->next->y > py)) && p->next->y != p->y &&
0 0 if (((p->y > py) != (p->next->y > py)) && p->next->y != p->y &&
0 0 if (((p->y > py) != (p->next->y > py)) && p->next->y != p->y &&
740 8 0 Node* p = nodes.construct(static_cast(i), util::nth<0, Point>::get(pt), util::nth<1, Point>::get(pt));
742 2 6 if (!last) {
747 0 6 assert(last);
761 0 8 if (p->prevZ) p->prevZ->nextZ = p->nextZ;
762 0 8 if (p->nextZ) p->nextZ->prevZ = p->prevZ;
768 1 0 mapbox::detail::Earcut earcut;
769 1 0 earcut(poly);