Herror ::intersection (
    Hobject Region1,
    Hobject Region2,
    Hobject *RegionIntersection
)
HRegion HRegion::Intersection (
    const HRegionArray &Region2
) const
HRegionArray HRegionArray::Intersection (
    const HRegionArray &Region2
) const

Calculate the intersection of two regions.

::intersection calculates the intersection of the regions in Region1 with the regions in Region2. Each region in Region1 is intersected with all regions in Region2. The order of regions in RegionIntersection is identical to the order of regions in Region1.


Attention

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


Parameters

Region1 (input_object)
region(-array) -> Hobject: HRegion(Array)
Regions to be intersected with all regions in Region2.

Region2 (input_object)
region(-array) -> Hobject: HRegion(Array)
Regions with which Region1 is intersected.

RegionIntersection (output_object)
region(-array) -> Hobject * : HRegion(Array)
Result of the intersection.
Number of elements: RegionIntersection <= Region1


Complexity

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


Result

::intersection always returns 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 handling is raised.


Possible Predecessors

::threshold, ::connection, ::regiongrowing, ::pouring


Possible Successors

::select_shape, ::disp_region


See also

::union1, ::union2, ::complement


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH