CAD Exchanger SDK
cadex::ModelData_Box2d Class Reference

Defines a 2D bounding box. More...

Public Member Functions

 ModelData_Box2d ()
 Constructor. More...
 
 ModelData_Box2d (const ModelData_Point2dd &theMinCorner, const ModelData_Point2dd &theMaxCorner)
 Constructor. More...
 
 ModelData_Box2d (const Bnd_Box2d &theBox)
 Constructor.
 
const ModelData_Point2dMinCorner () const
 
ModelData_Point2dMinCorner ()
 
const ModelData_Point2dMaxCorner () const
 
ModelData_Point2dMaxCorner ()
 
ModelData_Point2d Center () const
 Returns a center point. More...
 
void Add (const ModelData_Point2d &thePoint)
 Adds a point into the bounding box. More...
 
void Add (const ModelData_Box2d &theBox)
 Accumulates another bounding box.
 
void Clear ()
 Resets the bounding box. More...
 
void SetXRange (double theMin, double theMax)
 
void SetYRange (double theMin, double theMax)
 
void SetRange (size_t theIdx, double theMin, double theMax)
 
double Range (size_t theIdx) const
 
double XRange () const
 
double YRange () const
 
void Enlarge (double theX, double theY)
 
ModelData_Box2d Enlarged (double theX, double theY) const
 
bool IsIn (const ModelData_Point2d &thePoint) const
 Returns true if the point lies inside the box.
 
bool IsInfinite () const
 Returns true if at least one coordinate is infinite. More...
 
void Multiply (double theValue)
 
ModelData_Box2d Multiplied (double theValue) const
 
void Transform (const ModelData_Transformation2d &theTransformation)
 Applies transformation.
 
ModelData_Box2d Transformed (const ModelData_Transformation2d &theTransformation) const
 
 operator Bnd_Box2d () const
 Casts to a Bnd_Box object.
 

Detailed Description

Defines a 2D bounding box.

The box is defined via two corners - MinCorner() and MaxCorner() - containing minimum and maximum coordinates respectively.

See also
ModelData_Box.

Constructor & Destructor Documentation

◆ ModelData_Box2d() [1/2]

cadex::ModelData_Box2d::ModelData_Box2d ( )
inline

Constructor.

Creates a box with infinite boundaries.

◆ ModelData_Box2d() [2/2]

cadex::ModelData_Box2d::ModelData_Box2d ( const ModelData_Point2dd &  theMinCorner,
const ModelData_Point2dd &  theMaxCorner 
)
inline

Constructor.

Creates a box with specified minimum and maximum corners.

Member Function Documentation

◆ Add()

void cadex::ModelData_Box2d::Add ( const ModelData_Point2d thePoint)

Adds a point into the bounding box.

Takes into account only finite coordinates of thePoint (those which are less than 1e+100).

◆ Center()

ModelData_Point2d cadex::ModelData_Box2d::Center ( ) const
inline

Returns a center point.

Returns a middle of the diagonal between MinCorner() and MaxCorner().

◆ Clear()

void cadex::ModelData_Box2d::Clear ( )

Resets the bounding box.

Assigns infinite values to the coordinates, so that IsInfinite() returns true.

◆ IsInfinite()

bool cadex::ModelData_Box2d::IsInfinite ( ) const

Returns true if at least one coordinate is infinite.

Returns true if at least one coordinate is greater than 1e+100.

See also
Clear().

◆ MaxCorner() [1/2]

const ModelData_Point2d& cadex::ModelData_Box2d::MaxCorner ( ) const
inline

Returns the MaxCorner property.

◆ MaxCorner() [2/2]

ModelData_Point2d& cadex::ModelData_Box2d::MaxCorner ( )
inline

Returns the MaxCorner property.

◆ MinCorner() [1/2]

ModelData_Point2d& cadex::ModelData_Box2d::MinCorner ( )
inline

Returns the MinCorner property.

◆ MinCorner() [2/2]

const ModelData_Point2d& cadex::ModelData_Box2d::MinCorner ( ) const
inline

Returns the MinCorner property.