Upgrade to Wagyu 0.4.3

This commit is contained in:
Eric Fischer
2018-07-31 17:47:52 -07:00
parent 796fa19729
commit e9eca57393
61 changed files with 4830 additions and 5286 deletions
+37 -35
View File
@@ -22,39 +22,36 @@ active_bound_list_itr<T> do_maxima(active_bound_list_itr<T>& bnd,
clip_type cliptype,
fill_type subject_fill_type,
fill_type clip_fill_type,
ring_manager<T>& rings,
ring_manager<T>& manager,
active_bound_list<T>& active_bounds) {
if (bndMaxPair == active_bounds.end()) {
if ((*bnd)->ring) {
add_point_to_ring(*(*bnd), (*bnd)->current_edge->top, rings);
}
return active_bounds.erase(bnd);
}
auto bnd_next = std::next(bnd);
auto return_bnd = bnd_next;
auto return_bnd = bnd;
bool skipped = false;
while (bnd_next != active_bounds.end() && bnd_next != bndMaxPair) {
if (*bnd_next == nullptr) {
++bnd_next;
continue;
}
skipped = true;
intersect_bounds(bnd, bnd_next, (*bnd)->current_edge->top, cliptype, subject_fill_type,
clip_fill_type, rings, active_bounds);
swap_positions_in_ABL(bnd, bnd_next, active_bounds);
bnd_next = std::next(bnd);
intersect_bounds(*(*bnd), *(*bnd_next), (*bnd)->current_edge->top, cliptype,
subject_fill_type, clip_fill_type, manager, active_bounds);
std::iter_swap(bnd, bnd_next);
bnd = bnd_next;
++bnd_next;
}
if (!(*bnd)->ring && !(*bndMaxPair)->ring) {
active_bounds.erase(bndMaxPair);
} else if ((*bnd)->ring && (*bndMaxPair)->ring) {
add_local_maximum_point(bnd, bndMaxPair, (*bnd)->current_edge->top, rings, active_bounds);
active_bounds.erase(bndMaxPair);
} else {
if ((*bnd)->ring && (*bndMaxPair)->ring) {
add_local_maximum_point(*(*bnd), *(*bndMaxPair), (*bnd)->current_edge->top, manager,
active_bounds);
} else if ((*bnd)->ring || (*bndMaxPair)->ring) {
throw std::runtime_error("DoMaxima error");
}
auto prev_itr = active_bounds.erase(bnd);
if (skipped) {
return return_bnd;
} else {
return prev_itr;
*bndMaxPair = nullptr;
*bnd = nullptr;
if (!skipped) {
++return_bnd;
}
return return_bnd;
}
template <typename T>
@@ -63,12 +60,16 @@ void process_edges_at_top_of_scanbeam(T top_y,
scanbeam_list<T>& scanbeam,
local_minimum_ptr_list<T> const& minima_sorted,
local_minimum_ptr_list_itr<T>& current_lm,
ring_manager<T>& rings,
ring_manager<T>& manager,
clip_type cliptype,
fill_type subject_fill_type,
fill_type clip_fill_type) {
for (auto bnd = active_bounds.begin(); bnd != active_bounds.end();) {
if (*bnd == nullptr) {
++bnd;
continue;
}
// 1. Process maxima, treating them as if they are "bent" horizontal edges,
// but exclude maxima with horizontal edges.
@@ -81,7 +82,7 @@ void process_edges_at_top_of_scanbeam(T top_y,
is_maxima(bnd_max_pair, top_y));
if (is_maxima_edge) {
bnd = do_maxima(bnd, bnd_max_pair, cliptype, subject_fill_type, clip_fill_type,
rings, active_bounds);
manager, active_bounds);
continue;
}
}
@@ -89,23 +90,25 @@ void process_edges_at_top_of_scanbeam(T top_y,
// 2. Promote horizontal edges.
if (is_intermediate(bnd, top_y) && next_edge_is_horizontal<T>(bnd)) {
if ((*bnd)->ring) {
insert_hot_pixels_in_path(*(*bnd), (*bnd)->current_edge->top, rings, false);
insert_hot_pixels_in_path(*(*bnd), (*bnd)->current_edge->top, manager, false);
}
next_edge_in_bound(bnd, scanbeam);
next_edge_in_bound(*(*bnd), scanbeam);
if ((*bnd)->ring) {
add_point_to_ring(*(*bnd), (*bnd)->current_edge->bot, rings);
add_point_to_ring(*(*bnd), (*bnd)->current_edge->bot, manager);
}
} else {
(*bnd)->current_x = get_current_x(*((*bnd)->current_edge), top_y);
}
++bnd;
}
active_bounds.erase(std::remove(active_bounds.begin(), active_bounds.end(), nullptr),
active_bounds.end());
insert_horizontal_local_minima_into_ABL(top_y, minima_sorted, current_lm, active_bounds, rings,
scanbeam, cliptype, subject_fill_type, clip_fill_type);
insert_horizontal_local_minima_into_ABL(top_y, minima_sorted, current_lm, active_bounds,
manager, scanbeam, cliptype, subject_fill_type,
clip_fill_type);
process_horizontals(top_y, active_bounds, rings, scanbeam, cliptype, subject_fill_type,
process_horizontals(top_y, active_bounds, manager, scanbeam, cliptype, subject_fill_type,
clip_fill_type);
// 4. Promote intermediate vertices
@@ -113,10 +116,9 @@ void process_edges_at_top_of_scanbeam(T top_y,
for (auto bnd = active_bounds.begin(); bnd != active_bounds.end(); ++bnd) {
if (is_intermediate(bnd, top_y)) {
if ((*bnd)->ring) {
add_point_to_ring(*(*bnd), (*bnd)->current_edge->top, rings);
insert_hot_pixels_in_path(*(*bnd), (*bnd)->current_edge->top, rings, false);
add_point_to_ring(*(*bnd), (*bnd)->current_edge->top, manager);
}
next_edge_in_bound(bnd, scanbeam);
next_edge_in_bound(*(*bnd), scanbeam);
}
}
}