diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index 842e55eba..be42a4843 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -581,7 +581,8 @@ AsIfFlatRegion::selected_interacting_generic (const Region &other, int mode, boo proc.set_report_progress (report_progress ()); std::vector > 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 (), &op, oph.results ()); diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index 0f7ea7fd7..350e10fe2 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -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::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::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;