Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Region » Region Relations » InscribeRegionInRegion

InscribeRegionInRegion


Module: FoundationBasic

Shifts source region so that it is contained in target region.

Name Type Description
inTargetRegion Region Region to contain source region
inSourceRegion Region Region to be shifted
inPossibleShift ShiftType Possible directions of shift
inFitType FitType Determines if the common border length should be maximized
outShiftX Integer? X coordinate of the shift
outShiftY Integer? Y coordinate of the shift
outShiftedRegion Region? Shifted source region

Description

The filter shifts inSourceRegion so that it is entirely contained in inTargetRegion. When inFitType is FirstFit, the function returns first shift. With inFitType set to BestFit, the function chooses from all possible shifts one that maximizes length of common border of target region and shifted source region. Parameter inPossibleShift defines directions in which source region should be shifted. Possible values are Any, Vertical, Horizontal.

All return values are conditional. In case appropriate shift exists, outShiftX and outShiftY define its coordinates. outShiftedRegion is inSourceRegion translated by vector (outShiftX,outShiftY) and with dimensions of inTargetRegion.

Examples

InscribeRegionInRegion performed on pair of sample regions, shown on the left. Middle image shows inscribed region with inFitType set to FirstFit. Right one corresponds to inFitType equal BestFit.

Remarks

Setting parameter inFitType to BestFit results in much higher computational cost.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Source region cannot be empty in InscribeRegionInRegion.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

  • TranslateRegion – Translates a region by a given number of pixels along each axis.