unin1
先说 unin1 这个函数 很好理解,将多个区域求并集,结果就是多个区域会变成一个区域。
unin1 经常和 closing_circle 这个函数连用。 这是应为 当多个区域变成一个区域之后,才能更好的完成闭操作。
unin2
按照思维惯性,看上去就是将两个区域集合合并成,一个大的区域。但是其实不是。
Description
union2 computes the union of the region in Region1 with all regions in Region2. Internally, all regions of Region2 are united to a single region before the individual regions of Region1 are united with the already united region. This means that union2 is not commutative!
以上是原文解释,翻译翻译:
把第二个参数Region2里的所有区域合并,然后将合并后的区域分别与Region1中的每一个区域进行合并,然后保存到RegionUnion 中。最后,RegionUnion 元素个数与Region1元素个数相同。
所以,如果调换两个Region1和Region2将得到不用的效果。
如果你想得到一个区域,就需要再次调用一下union1(RegionUnion)。
或者在调用union2时,先确保Region1是一个区域,调用一下union1(Region1)
concat_obj
concat_obj,仅仅是添加对象到一个集合,如果添加的对象是Region。也就仅仅是添加不会合并,Region也可以重复被添加,集合的个数也会随之增加。
如何合并多个区域为一个区域
我目前认为最快的方式是,先通过concat_obj把所有的区域添加到一个集合内部。
然后直接调用union1。
//添加三种瑕疵在一起
HOperatorSet.ConcatObj(ho_SelectedDot, ho_SelectedLine, out MarkRegion);
HOperatorSet.ConcatObj(ho_SelectedOther, MarkRegion, out MarkRegion);
//合并
HOperatorSet.Union1(MarkRegion,out ho_tmp);