Region#inside/not_inside/covering/not_covering is faster as it skips the merge step now. Fixed deep mode implementation (counting mode detection) with performance effect on outside/interacting too

This commit is contained in:
Matthias Koefferlein 2022-12-03 20:59:36 +01:00
parent cca20773a7
commit 63ad38e9d9
2 changed files with 8 additions and 4 deletions

View File

@ -581,7 +581,8 @@ AsIfFlatRegion::selected_interacting_generic (const Region &other, int mode, boo
proc.set_report_progress (report_progress ());
std::vector<generic_shape_iterator<db::Polygon> > others;
others.push_back ((mode < 0 || counting) ? other.begin_merged () : other.begin ());
// NOTE: with counting the other region needs to be merged
others.push_back (counting ? other.begin_merged () : other.begin ());
proc.run_flat (polygons, others, std::vector<bool> (), &op, oph.results ());

View File

@ -1952,6 +1952,7 @@ DeepRegion::selected_interacting_generic (const Region &other, int mode, bool to
}
}
min_count = std::max (size_t (1), min_count);
bool counting = !(min_count == 1 && max_count == std::numeric_limits<size_t>::max ());
// with these flag set to true, the resulting polygons are broken again.
@ -1966,9 +1967,8 @@ DeepRegion::selected_interacting_generic (const Region &other, int mode, bool to
}
const db::DeepLayer &polygons = merged_deep_layer ();
// NOTE: on "inside" or with counting, the other polygons must be merged
bool other_needs_merged = (mode < 0 || counting);
const db::DeepLayer &other_polygons = other_needs_merged ? other_deep->merged_deep_layer () : other_deep->deep_layer ();
// NOTE: with counting, the other polygons must be merged
const db::DeepLayer &other_polygons = counting ? other_deep->merged_deep_layer () : other_deep->deep_layer ();
db::InteractingLocalOperation op (mode, touching, output_mode, min_count, max_count, true);
@ -2011,6 +2011,7 @@ DeepRegion::selected_interacting_generic (const Edges &other, InteractingOutputM
}
}
min_count = std::max (size_t (1), min_count);
bool counting = !(min_count == 1 && max_count == std::numeric_limits<size_t>::max ());
// with these flag set to true, the resulting polygons are broken again.
@ -2181,6 +2182,8 @@ DeepRegion::selected_interacting_generic (const Texts &other, InteractingOutputM
}
}
min_count = std::max (size_t (1), min_count);
// with these flag set to true, the resulting polygons are broken again.
bool split_after = false;