You are here: Start » Function Reference » Region » Region Features » RegionDiameter

RegionDiameter
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationBasic |
Computes the longest segment connecting two pixels contained in region and its length.
Syntax
void fil::RegionDiameter ( const fil::Region& inRegion, ftl::Optional<fil::Segment2D&> outDiameter = ftl::NIL, ftl::Optional<float&> outDiameterLength = ftl::NIL )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inRegion | const Region& | Input region | |
![]() |
outDiameter | Optional<Segment2D&> | NIL | |
![]() |
outDiameterLength | Optional<float&> | NIL |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::NIL
to these parameters: outDiameter, outDiameterLength.
Read more about Optional Outputs.
Description
The operation finds the most distant pair of region pixels and returns the distance between them (outDiameterLength) and the segment representing the diameter (outDiameter). If there is more than one pair of maximal distance, the returned segment will correspond to one of them. The orientation of the resulting outDiameter is always between 0 and 180 degrees.
Hints
- If the input region is not guaranteed to be non-empty, precede this filter with SkipEmptyRegion.
Examples
![]() |
The resulting outDiameterLength = 276.4815, outDiameter segment was drawn onto the region.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Empty region on input in RegionDiameter. |
See Also
- RegionPerimeterLength – Computes the length of the input region perimeter.
- PathDiameter – Finds the longest segment connecting two characteristic points of a path.