| 1433 | } |
| 1434 | |
| 1435 | void ClipperBase::JoinOutrecPaths(Active& e1, Active& e2) |
| 1436 | { |
| 1437 | //join e2 outrec path onto e1 outrec path and then delete e2 outrec path |
| 1438 | //pointers. (NB Only very rarely do the joining ends share the same coords.) |
| 1439 | OutPt* p1_st = e1.outrec->pts; |
| 1440 | OutPt* p2_st = e2.outrec->pts; |
| 1441 | OutPt* p1_end = p1_st->next; |
| 1442 | OutPt* p2_end = p2_st->next; |
| 1443 | if (IsFront(e1)) |
| 1444 | { |
| 1445 | p2_end->prev = p1_st; |
| 1446 | p1_st->next = p2_end; |
| 1447 | p2_st->next = p1_end; |
| 1448 | p1_end->prev = p2_st; |
| 1449 | e1.outrec->pts = p2_st; |
| 1450 | e1.outrec->front_edge = e2.outrec->front_edge; |
| 1451 | if (e1.outrec->front_edge) |
| 1452 | e1.outrec->front_edge->outrec = e1.outrec; |
| 1453 | } |
| 1454 | else |
| 1455 | { |
| 1456 | p1_end->prev = p2_st; |
| 1457 | p2_st->next = p1_end; |
| 1458 | p1_st->next = p2_end; |
| 1459 | p2_end->prev = p1_st; |
| 1460 | e1.outrec->back_edge = e2.outrec->back_edge; |
| 1461 | if (e1.outrec->back_edge) |
| 1462 | e1.outrec->back_edge->outrec = e1.outrec; |
| 1463 | } |
| 1464 | |
| 1465 | //after joining, the e2.OutRec must contains no vertices ... |
| 1466 | e2.outrec->front_edge = nullptr; |
| 1467 | e2.outrec->back_edge = nullptr; |
| 1468 | e2.outrec->pts = nullptr; |
| 1469 | |
| 1470 | if (IsOpenEnd(e1)) |
| 1471 | { |
| 1472 | e2.outrec->pts = e1.outrec->pts; |
| 1473 | e1.outrec->pts = nullptr; |
| 1474 | } |
| 1475 | else |
| 1476 | SetOwner(e2.outrec, e1.outrec); |
| 1477 | |
| 1478 | //and e1 and e2 are maxima and are about to be dropped from the Actives list. |
| 1479 | e1.outrec = nullptr; |
| 1480 | e2.outrec = nullptr; |
| 1481 | } |
| 1482 | |
| 1483 | OutRec* ClipperBase::NewOutRec() |
| 1484 | { |