Skip to content

intersectionIntersectionIntersectionintersectionintersection🔗

Short description🔗

intersectionIntersectionIntersectionintersectionintersection — Calculate the intersection of two regions.

Signature🔗

intersection( region Region1, region Region2, out region RegionIntersection )void Intersection( const HObject& Region1, const HObject& Region2, HObject* RegionIntersection )static void HOperatorSet.Intersection( HObject region1, HObject region2, out HObject regionIntersection )def intersection( region_1: HObject, region_2: HObject ) -> HObject

Herror intersection( const Hobject Region1, const Hobject Region2, Hobject* RegionIntersection )

Herror T_intersection( const Hobject Region1, const Hobject Region2, Hobject* RegionIntersection )

HRegion HRegion::Intersection( const HRegion& Region2 ) const

HRegion HRegion.Intersection( HRegion region2 )

Description🔗

intersectionIntersection calculates the intersection of the regions in Region1region1region_1 with the regions in Region2region2region_2. Each region in Region1region1region_1 is intersected with all regions in Region2region2region_2. That is, internally all regions of Region2region2region_2 are united to a single region before the individual regions of Region1region1region_1 are intersected with the united region. The order of regions in RegionIntersectionregionIntersectionregion_intersection is identical to the order of regions in Region1region1region_1.

Attention🔗

Empty input regions are permitted. Because empty result regions are possible, the system flag 'store_empty_region'"store_empty_region" should be set appropriately.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Region1region1region_1 (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions to be intersected with all regions in Region2.

Region2region2region_2 (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions with which Region1 is intersected.

RegionIntersectionregionIntersectionregion_intersection (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Result of the intersection.

Number of elements: RegionIntersection <= Region1

Complexity🔗

Let \(N\) be the number of regions in Region1region1region_1, \(F_{1}\) be their average area, and \(F_{2}\) be the total area of all regions in Region2region2region_2. Then the runtime complexity is \(O(F_{1} \log{(F_{1})} + N * (\sqrt{F_{1}} + \sqrt{F_{2}}))\).

Result🔗

intersectionIntersection always returns 2 (H_MSG_TRUE). The behavior in case of empty input (no regions given) can be set via set_system('no_object_result',<Result>) and the behavior in case of an empty input region via set_system('empty_region_result',<Result>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, connectionConnection, regiongrowingRegiongrowing, pouringPouring

Possible successors

select_shapeSelectShape, disp_regionDispRegion

See also

union1Union1, union2Union2, complementComplement

Module🔗

Foundation