MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / ProcessIntersectList

Method ProcessIntersectList

CPP/Clipper2Lib/src/clipper.engine.cpp:2448–2480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2446 }
2447
2448 void ClipperBase::ProcessIntersectList()
2449 {
2450 //We now have a list of intersections required so that edges will be
2451 //correctly positioned at the top of the scanbeam. However, it's important
2452 //that edge intersections are processed from the bottom up, but it's also
2453 //crucial that intersections only occur between adjacent edges.
2454
2455 //First we do a quicksort so intersections proceed in a bottom up order ...
2456 std::sort(intersect_nodes_.begin(), intersect_nodes_.end(), IntersectListSort);
2457 //Now as we process these intersections, we must sometimes adjust the order
2458 //to ensure that intersecting edges are always adjacent ...
2459
2460 IntersectNodeList::iterator node_iter, node_iter2;
2461 for (node_iter = intersect_nodes_.begin();
2462 node_iter != intersect_nodes_.end(); ++node_iter)
2463 {
2464 if (!EdgesAdjacentInAEL(*node_iter))
2465 {
2466 node_iter2 = node_iter + 1;
2467 while (!EdgesAdjacentInAEL(*node_iter2)) ++node_iter2;
2468 std::swap(*node_iter, *node_iter2);
2469 }
2470
2471 IntersectNode& node = *node_iter;
2472 IntersectEdges(*node.edge1, *node.edge2, node.pt);
2473 SwapPositionsInAEL(*node.edge1, *node.edge2);
2474
2475 node.edge1->curr_x = node.pt.x;
2476 node.edge2->curr_x = node.pt.x;
2477 CheckJoinLeft(*node.edge2, node.pt, true);
2478 CheckJoinRight(*node.edge1, node.pt, true);
2479 }
2480 }
2481
2482 void ClipperBase::SwapPositionsInAEL(Active& e1, Active& e2)
2483 {

Callers

nothing calls this directly

Calls 3

EdgesAdjacentInAELFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected