You are here: Start » AVL.NET » Function Reference » Region » Region Relations » AVL.InscribeRegionInRegion

AVL.InscribeRegionInRegion

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

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void InscribeRegionInRegion
(
	AvlNet.Region inTargetRegion,
	AvlNet.Region inSourceRegion,
	AvlNet.ShiftType inPossibleShift,
	AvlNet.FitType inFitType,
	out int? outShiftX,
	out int? outShiftY,
	INullable<AvlNet.Region> outShiftedRegion
)

Parameters

Name Type Range Default Description
inTargetRegionAvlNet.RegionRegion to contain source region.
inSourceRegionAvlNet.RegionRegion to be shifted.
inPossibleShiftAvlNet.ShiftTypePossible directions of shift.
inFitTypeAvlNet.FitTypeDetermines if the common border length should be maximized.
outShiftXint?X coordinate of the shift.
outShiftYint?Y coordinate of the shift.
outShiftedRegionAvlNet.INullable<AvlNet.Region>Shifted source region. This parameter cannot be null.

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

List of possible exceptions:

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

See also