Hide menu
Loading...
Searching...
No Matches
cadex::Measurements::BoundingBox2d Class Reference

Computes bounding rectangles for 2D geometry. More...

Static Public Member Functions

static Geom::Box2d ComputeOriented (const Drawing::CurveSet &theCurves, const BoundingBox2dParameters &theParameters={})
 Computes an oriented bounding rectangle for the specified 2D curves.
 
static Geom::Box2d ComputeOriented (std::vector< Geom::Point2d > theCurves, const BoundingBox2dParameters &theParameters={})
 

Detailed Description

Computes bounding rectangles for 2D geometry.

The class provides algorithms for computing a rectangle that encloses the specified 2D geometry.

An oriented bounding rectangle is allowed to have an arbitrary orientation. Its orientation is selected to optimize the rectangle according to the criterion specified in BoundingBox2dParameters, such as minimum area or minimum perimeter.

For a set of points, the rectangle is computed directly from the input points. For a CurveSet, the curves are first discretized using the discretization tolerance specified in BoundingBox2dParameters, and the resulting points are used for the rectangle computation.

The returned Geom::Box2d contains the rectangle position, orientation, width, and height.

See also
BoundingBox2dParameters

Member Function Documentation

◆ ComputeOriented()

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeOriented ( const Drawing::CurveSet & theCurves,
const BoundingBox2dParameters & theParameters = {} )
static

Computes an oriented bounding rectangle for the specified 2D curves.

The curves are discretized using the tolerance specified in theParameters. The rectangle orientation is selected according to the optimization criterion specified in theParameters.