Back to FabImage Library website
You are here: Start » Function Reference » Region » Region Metrics » RegionToRegionDistance

RegionToRegionDistance
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationBasic |
Computes minimal distance between one of the points of the first region with one of the points of the second region.
Syntax
C++
C#
void fil::RegionToRegionDistance ( const fil::Region& inRegion1, const fil::Region& inRegion2, float inResolution, float& outDistance, ftl::Optional<fil::Segment2D&> outConnectingSegment = ftl::NIL )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inRegion1 | const Region& | First input region | ||
![]() |
inRegion2 | const Region& | Second input region | ||
![]() |
inResolution | float | 0.0 - ![]() |
1.0f | Number of real-world units per one pixel |
![]() |
outDistance | float& | |||
![]() |
outConnectingSegment | Optional<Segment2D&> | NIL |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::NIL
to these parameters: outConnectingSegment.
Read more about Optional Outputs.
Description
Operation computes length of the shortest segment that connects center of one of inRegion1's point which center of one of inRegion2's point.
Examples
![]() |
![]() |
![]() |
RegionToRegionDistance performed on sample regions produced outDistance = 118,5116. The shortest segment connecting regions is presented on the bottom image
Remarks
- inRegion1 and inRegion2 must not be empty, otherwise an error with appropriate description occurs.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Empty region on input in RegionToRegionDistance. |