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 ComputeAxisAligned (const Drawing::Drawing &theDrawing, const Geom::Transformation2d &theTransformation={})
 Computes an axis-aligned bounding box for the geometry in all sheets of the drawing.
 
static Geom::Box2d ComputeAxisAligned (const Drawing::Sheet &theSheet, const Geom::Transformation2d &theTransformation={})
 Computes an axis-aligned bounding box for the geometry in all views of the sheet.
 
static Geom::Box2d ComputeAxisAligned (const Drawing::View &theView, const Geom::Transformation2d &theTransformation={})
 Computes an axis-aligned bounding box for the geometry in the view, in sheet coordinates.
 
static Geom::Box2d ComputeAxisAligned (const Drawing::Element &theElement, const Geom::Transformation2d &theTransformation={})
 Computes an axis-aligned bounding box for the geometry of the element, in its local coordinates.
 
static Geom::Box2d ComputeAxisAligned (const Drawing::CurveSet &theCurves, const Geom::Transformation2d &theTransformation={})
 Computes an axis-aligned bounding box for the specified 2D curves over their own parameter ranges.
 
static Geom::Box2d ComputeAxisAligned (const std::vector< Geom::Point2d > &thePoints, const Geom::Transformation2d &theTransformation={})
 Computes an axis-aligned bounding box for the specified 2D points.
 
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 ComputeOriented(), 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 axis-aligned box is computed directly from curve bounds or point coordinates. For drawing objects, it includes curve sets, piecewise contours, points and hatch boundaries. Text and dimension annotations are ignored. View positions and scales are applied before the optional transformation. Sheet paper sizes are ignored.

Both methods return a Geom::Box2d containing the rectangle position, orientation, width, and height. ComputeAxisAligned() aligns its axes with the coordinate axes.

See also
BoundingBox2dParameters

Member Function Documentation

◆ ComputeAxisAligned() [1/6]

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeAxisAligned ( const Drawing::CurveSet & theCurves,
const Geom::Transformation2d & theTransformation = {} )
static

Computes an axis-aligned bounding box for the specified 2D curves over their own parameter ranges.

Applies theTransformation to copies of the curves before computing their bounds. The default transformation is the identity. The box axes coincide with the coordinate axes. Returns an infinite box for empty input, unbounded curves or failed computations.

◆ ComputeAxisAligned() [2/6]

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeAxisAligned ( const Drawing::Drawing & theDrawing,
const Geom::Transformation2d & theTransformation = {} )
static

Computes an axis-aligned bounding box for the geometry in all sheets of the drawing.

Sheet coordinates are combined without arranging the sheets relative to each other. Applies theTransformation after view positions and scales. The default transformation is the identity. Returns an infinite box if no supported geometry is found, or if bounds cannot be computed.

◆ ComputeAxisAligned() [3/6]

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeAxisAligned ( const Drawing::Element & theElement,
const Geom::Transformation2d & theTransformation = {} )
static

Computes an axis-aligned bounding box for the geometry of the element, in its local coordinates.

Supports curve sets, piecewise contours, point sets and hatch boundaries. Applies theTransformation before computing bounds. The default transformation is the identity. Returns an infinite box for unsupported elements, empty geometry or failed computations.

◆ ComputeAxisAligned() [4/6]

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeAxisAligned ( const Drawing::Sheet & theSheet,
const Geom::Transformation2d & theTransformation = {} )
static

Computes an axis-aligned bounding box for the geometry in all views of the sheet.

Applies theTransformation after view positions and scales. The default transformation is the identity. Returns an infinite box if no supported geometry is found, or if bounds cannot be computed.

◆ ComputeAxisAligned() [5/6]

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeAxisAligned ( const Drawing::View & theView,
const Geom::Transformation2d & theTransformation = {} )
static

Computes an axis-aligned bounding box for the geometry in the view, in sheet coordinates.

Applies theTransformation after the view position and scale. The default transformation is the identity. Returns an infinite box if no supported geometry is found, or if bounds cannot be computed.

◆ ComputeAxisAligned() [6/6]

Geom::Box2d cadex::Measurements::BoundingBox2d::ComputeAxisAligned ( const std::vector< Geom::Point2d > & thePoints,
const Geom::Transformation2d & theTransformation = {} )
static

Computes an axis-aligned bounding box for the specified 2D points.

Applies theTransformation to the points before computing their bounds. The default transformation is the identity. The box axes coincide with the coordinate axes. Returns an infinite box for empty input or non-finite point coordinates.

◆ 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.