Back to FabImage Library website
You are here: Start » Function Reference » Geometry 2D » Geometry 2D Features » PointsBoundingRectangle
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Computes the smallest rectangle containing an array of points.
Syntax
C++
C#
void fil::PointsBoundingRectangle ( const ftl::Array<fil::Point2D>& inPoints, fil::BoundingRectangleFeature::Type inBoundingRectangleFeature, float inReferenceAngle, fil::RectangleOrientation::Type inRectangleOrientation, fil::Rectangle2D& outBoundingRectangle, ftl::Optional<fil::Point2D&> outCenter = ftl::NIL, ftl::Optional<float&> outLongSide = ftl::NIL, ftl::Optional<float&> outShortSide = ftl::NIL )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inPoints | const Array<Point2D>& | Input array of points | |
![]() |
inBoundingRectangleFeature | BoundingRectangleFeature::Type | MinimalArea | Determines what kind of bounding rectangle will be computed |
![]() |
inReferenceAngle | float | 0.0f | The middle angle of the valid range of the output rectangle's angle |
![]() |
inRectangleOrientation | RectangleOrientation::Type | Horizontal | Orientation of the output rectangle |
![]() |
outBoundingRectangle | Rectangle2D& | Smallest bounding rectangle of the input points | |
![]() |
outCenter | Optional<Point2D&> | NIL | Center of the bounding rectangle |
![]() |
outLongSide | Optional<float&> | NIL | Length of the bounding rectangle long side |
![]() |
outShortSide | Optional<float&> | NIL | Length of the bounding rectangle short side |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::NIL
to these parameters: outCenter, outLongSide, outShortSide.
Read more about Optional Outputs.
Description
The filter computes a rectangle with the smallest possible selected feature that contains all given points. The angle of the resulting rectangle is then normalized as in the NormalizeRectangleOrientation filter.
Examples
![]() |
The resulting outBoundingRectangle drawn with the input points and with inRectangleOrientation set on Horizontal
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Incorrect BoundingRectangleFeature in PointsBoundingRectangle. |
DomainError | No points on input in PointsBoundingRectangle. |
See Also
- NormalizeRectangleOrientation – Changes orientation of the given rectangle according to parameters.