| 2535 | } |
| 2536 | |
| 2537 | void ClipperBase::DoHorizontal(Active& horz) |
| 2538 | /******************************************************************************* |
| 2539 | * Notes: Horizontal edges (HEs) at scanline intersections (ie at the top or * |
| 2540 | * bottom of a scanbeam) are processed as if layered.The order in which HEs * |
| 2541 | * are processed doesn't matter. HEs intersect with the bottom vertices of * |
| 2542 | * other HEs[#] and with non-horizontal edges [*]. Once these intersections * |
| 2543 | * are completed, intermediate HEs are 'promoted' to the next edge in their * |
| 2544 | * bounds, and they in turn may be intersected[%] by other HEs. * |
| 2545 | * * |
| 2546 | * eg: 3 horizontals at a scanline: / | / / * |
| 2547 | * | / | (HE3)o ========%========== o * |
| 2548 | * o ======= o(HE2) / | / / * |
| 2549 | * o ============#=========*======*========#=========o (HE1) * |
| 2550 | * / | / | / * |
| 2551 | *******************************************************************************/ |
| 2552 | { |
| 2553 | Point64 pt; |
| 2554 | bool horzIsOpen = IsOpen(horz); |
| 2555 | int64_t y = horz.bot.y; |
| 2556 | Vertex* vertex_max; |
| 2557 | if (horzIsOpen) |
| 2558 | vertex_max = GetCurrYMaximaVertex_Open(horz); |
| 2559 | else |
| 2560 | vertex_max = GetCurrYMaximaVertex(horz); |
| 2561 | |
| 2562 | //// remove 180 deg.spikes and also simplify |
| 2563 | //// consecutive horizontals when PreserveCollinear = true |
| 2564 | //if (!horzIsOpen && vertex_max != horz.vertex_top) |
| 2565 | // TrimHorz(horz, PreserveCollinear); |
| 2566 | |
| 2567 | int64_t horz_left, horz_right; |
| 2568 | bool is_left_to_right = |
| 2569 | ResetHorzDirection(horz, vertex_max, horz_left, horz_right); |
| 2570 | |
| 2571 | if (IsHotEdge(horz)) |
| 2572 | { |
| 2573 | #ifdef USINGZ |
| 2574 | OutPt* op = AddOutPt(horz, Point64(horz.curr_x, y, horz.bot.z)); |
| 2575 | #else |
| 2576 | OutPt* op = AddOutPt(horz, Point64(horz.curr_x, y)); |
| 2577 | #endif |
| 2578 | AddTrialHorzJoin(op); |
| 2579 | } |
| 2580 | |
| 2581 | while (true) // loop through consec. horizontal edges |
| 2582 | { |
| 2583 | Active* e; |
| 2584 | if (is_left_to_right) e = horz.next_in_ael; |
| 2585 | else e = horz.prev_in_ael; |
| 2586 | |
| 2587 | while (e) |
| 2588 | { |
| 2589 | if (e->vertex_top == vertex_max) |
| 2590 | { |
| 2591 | if (IsHotEdge(horz) && IsJoined(*e)) |
| 2592 | Split(*e, e->top); |
| 2593 | |
| 2594 | //if (IsHotEdge(horz) != IsHotEdge(*e)) |
nothing calls this directly
no test coverage detected