OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    Bnd_Box2d Class Reference

    Describes a bounding box in 2D space. A bounding box is parallel to the axes of the coordinates system. If it is finite, it is defined by the two intervals: More...

    #include <Bnd_Box2d.hxx>

    Data Structures

    struct  Limits
     Structure containing the 2D box limits (Xmin, Xmax, Ymin, Ymax). The values include the gap and account for open directions. More...

    Public Member Functions

    void SetWhole () noexcept
     Sets this bounding box so that it covers the whole 2D space, i.e. it is infinite in all directions.
    void SetVoid () noexcept
     Sets this 2D bounding box so that it is empty. All points are outside a void box.
    void Set (const gp_Pnt2d &thePnt)
     Sets this 2D bounding box so that it bounds the point P. This involves first setting this bounding box to be void and then adding the point PThe rectangle bounds the point.
    void Set (const gp_Pnt2d &thePnt, const gp_Dir2d &theDir)
     Sets this 2D bounding box so that it bounds the half-line defined by point P and direction D, i.e. all points M defined by M=P+u*D, where u is greater than or equal to 0, are inside the bounding area. This involves first setting this 2D box to be void and then adding the half-line.
    void Update (const double aXmin, const double aYmin, const double aXmax, const double aYmax)
     Enlarges this 2D bounding box, if required, so that it contains at least:
    void Update (const double X, const double Y)
     Adds a point of coordinates (X,Y) to this bounding box.
    constexpr double GetGap () const noexcept
     Returns the gap of this 2D bounding box.
    void SetGap (const double Tol) noexcept
     Set the gap of this 2D bounding box to abs(Tol).
    void Enlarge (const double theTol) noexcept
     Enlarges the box with a tolerance value. This means that the minimum values of its X and Y intervals of definition, when they are finite, are reduced by the absolute value of Tol, while the maximum values are increased by the same amount.
    void Get (double &aXmin, double &aYmin, double &aXmax, double &aYmax) const
     Returns the bounds of this 2D bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). if IsVoid().
    Limits Get () const
     Returns the bounds of this 2D bounding box as a Limits structure. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). If the box is void, returns raw internal values. Can be used with C++17 structured bindings:
    double GetXMin () const
     Returns the Xmin value (IsOpenXmin() ? -Precision::Infinite() : Xmin - GetGap()).
    double GetXMax () const
     Returns the Xmax value (IsOpenXmax() ? Precision::Infinite() : Xmax + GetGap()).
    double GetYMin () const
     Returns the Ymin value (IsOpenYmin() ? -Precision::Infinite() : Ymin - GetGap()).
    double GetYMax () const
     Returns the Ymax value (IsOpenYmax() ? Precision::Infinite() : Ymax + GetGap()).
    std::optional< gp_Pnt2dCenter () const
     Returns the center of this 2D bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Returns std::nullopt if the box is void.
    void OpenXmin () noexcept
     The Box will be infinitely long in the Xmin direction.
    void OpenXmax () noexcept
     The Box will be infinitely long in the Xmax direction.
    void OpenYmin () noexcept
     The Box will be infinitely long in the Ymin direction.
    void OpenYmax () noexcept
     The Box will be infinitely long in the Ymax direction.
    bool IsOpenXmin () const noexcept
     Returns true if this bounding box is open in the Xmin direction.
    bool IsOpenXmax () const noexcept
     Returns true if this bounding box is open in the Xmax direction.
    bool IsOpenYmin () const noexcept
     Returns true if this bounding box is open in the Ymin direction.
    bool IsOpenYmax () const noexcept
     Returns true if this bounding box is open in the Ymax direction.
    bool IsWhole () const noexcept
     Returns true if this bounding box is infinite in all 4 directions (Whole Space flag).
    bool IsVoid () const noexcept
     Returns true if this 2D bounding box is empty (Void flag).
    Bnd_Box2d Transformed (const gp_Trsf2d &T) const
     Returns a bounding box which is the result of applying the transformation T to this bounding box. Warning Applying a geometric transformation (for example, a rotation) to a bounding box generally increases its dimensions. This is not optimal for algorithms which use it.
    void Add (const Bnd_Box2d &Other)
     Adds the 2d box <Other> to <me>.
    void Add (const gp_Pnt2d &thePnt) noexcept
     Adds the 2d point.
    void Add (const gp_Pnt2d &thePnt, const gp_Dir2d &theDir) noexcept
     Extends bounding box from thePnt in the direction theDir.
    void Add (const gp_Dir2d &D)
     Extends the Box in the given Direction, i.e. adds a half-line. The box may become infinite in 1 or 2 directions.
    bool IsOut (const gp_Pnt2d &P) const
     Returns True if the 2d pnt.
    bool IsOut (const gp_Lin2d &theL) const
     Returns True if the line doesn't intersect the box.
    bool IsOut (const gp_Pnt2d &theP0, const gp_Pnt2d &theP1) const
     Returns True if the segment doesn't intersect the box.
    bool IsOut (const Bnd_Box2d &Other) const
     Returns True if <Box2d> is out <me>.
    bool Contains (const gp_Pnt2d &theP) const
     Returns True if the 2d point is inside or on the boundary of this box.
    bool Intersects (const Bnd_Box2d &theOther) const
     Returns True if the other 2d box intersects or is inside this box.
    double Distance (const Bnd_Box2d &theOther) const
     Computes the minimum distance between two 2D boxes.
    bool IsOut (const Bnd_Box2d &theOther, const gp_Trsf2d &theTrsf) const noexcept
     Returns True if transformed <Box2d> is out <me>.
    bool IsOut (const gp_Trsf2d &T1, const Bnd_Box2d &Other, const gp_Trsf2d &T2) const noexcept
     Compares a transformed bounding with a transformed bounding. The default implementation is to make a copy of <me> and <Other>, to transform them and to test.
    void Dump () const
    double SquareExtent () const noexcept
     Computes the squared diagonal of me.

    Protected Types

    enum  MaskFlags {
      VoidMask = 0x01 , XminMask = 0x02 , XmaxMask = 0x04 , YminMask = 0x08 ,
      YmaxMask = 0x10 , WholeMask = 0x1e
    }
     Bit flags. More...

    Detailed Description

    Describes a bounding box in 2D space. A bounding box is parallel to the axes of the coordinates system. If it is finite, it is defined by the two intervals:

    • [ Xmin,Xmax ], and
    • [ Ymin,Ymax ]. A bounding box may be infinite (i.e. open) in one or more directions. It is said to be:
    • OpenXmin if it is infinite on the negative side of the "X Direction";
    • OpenXmax if it is infinite on the positive side of the "X Direction";
    • OpenYmin if it is infinite on the negative side of the "Y Direction";
    • OpenYmax if it is infinite on the positive side of the "Y Direction";
    • WholeSpace if it is infinite in all four directions. In this case, any point of the space is inside the box;
    • Void if it is empty. In this case, there is no point included in the box. A bounding box is defined by four bounds (Xmin, Xmax, Ymin and Ymax) which limit the bounding box if it is finite, six flags (OpenXmin, OpenXmax, OpenYmin, OpenYmax, WholeSpace and Void) which describe the bounding box if it is infinite or empty, and
    • a gap, which is included on both sides in any direction when consulting the finite bounds of the box.

    Member Enumeration Documentation

    ◆ MaskFlags

    enum Bnd_Box2d::MaskFlags
    protected

    Bit flags.

    Enumerator
    VoidMask 
    XminMask 
    XmaxMask 
    YminMask 
    YmaxMask 
    WholeMask 

    Member Function Documentation

    ◆ Add() [1/4]

    void Bnd_Box2d::Add ( const Bnd_Box2d & Other)

    Adds the 2d box <Other> to <me>.

    ◆ Add() [2/4]

    void Bnd_Box2d::Add ( const gp_Dir2d & D)

    Extends the Box in the given Direction, i.e. adds a half-line. The box may become infinite in 1 or 2 directions.

    ◆ Add() [3/4]

    void Bnd_Box2d::Add ( const gp_Pnt2d & thePnt)
    inlinenoexcept

    Adds the 2d point.

    ◆ Add() [4/4]

    void Bnd_Box2d::Add ( const gp_Pnt2d & thePnt,
    const gp_Dir2d & theDir )
    inlinenoexcept

    Extends bounding box from thePnt in the direction theDir.

    ◆ Center()

    std::optional< gp_Pnt2d > Bnd_Box2d::Center ( ) const
    nodiscard

    Returns the center of this 2D bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Returns std::nullopt if the box is void.

    ◆ Contains()

    bool Bnd_Box2d::Contains ( const gp_Pnt2d & theP) const
    inlinenodiscard

    Returns True if the 2d point is inside or on the boundary of this box.

    ◆ Distance()

    double Bnd_Box2d::Distance ( const Bnd_Box2d & theOther) const
    nodiscard

    Computes the minimum distance between two 2D boxes.

    ◆ Dump()

    void Bnd_Box2d::Dump ( ) const

    ◆ Enlarge()

    void Bnd_Box2d::Enlarge ( const double theTol)
    inlinenoexcept

    Enlarges the box with a tolerance value. This means that the minimum values of its X and Y intervals of definition, when they are finite, are reduced by the absolute value of Tol, while the maximum values are increased by the same amount.

    ◆ Get() [1/2]

    Limits Bnd_Box2d::Get ( ) const
    nodiscard

    Returns the bounds of this 2D bounding box as a Limits structure. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). If the box is void, returns raw internal values. Can be used with C++17 structured bindings:

    auto [xmin, xmax, ymin, ymax] = aBox.Get();

    ◆ Get() [2/2]

    void Bnd_Box2d::Get ( double & aXmin,
    double & aYmin,
    double & aXmax,
    double & aYmax ) const

    Returns the bounds of this 2D bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). if IsVoid().

    ◆ GetGap()

    double Bnd_Box2d::GetGap ( ) const
    inlinenodiscardconstexprnoexcept

    Returns the gap of this 2D bounding box.

    ◆ GetXMax()

    double Bnd_Box2d::GetXMax ( ) const
    nodiscard

    Returns the Xmax value (IsOpenXmax() ? Precision::Infinite() : Xmax + GetGap()).

    ◆ GetXMin()

    double Bnd_Box2d::GetXMin ( ) const
    nodiscard

    Returns the Xmin value (IsOpenXmin() ? -Precision::Infinite() : Xmin - GetGap()).

    ◆ GetYMax()

    double Bnd_Box2d::GetYMax ( ) const
    nodiscard

    Returns the Ymax value (IsOpenYmax() ? Precision::Infinite() : Ymax + GetGap()).

    ◆ GetYMin()

    double Bnd_Box2d::GetYMin ( ) const
    nodiscard

    Returns the Ymin value (IsOpenYmin() ? -Precision::Infinite() : Ymin - GetGap()).

    ◆ Intersects()

    bool Bnd_Box2d::Intersects ( const Bnd_Box2d & theOther) const
    inlinenodiscard

    Returns True if the other 2d box intersects or is inside this box.

    ◆ IsOpenXmax()

    bool Bnd_Box2d::IsOpenXmax ( ) const
    inlinenodiscardnoexcept

    Returns true if this bounding box is open in the Xmax direction.

    ◆ IsOpenXmin()

    bool Bnd_Box2d::IsOpenXmin ( ) const
    inlinenodiscardnoexcept

    Returns true if this bounding box is open in the Xmin direction.

    ◆ IsOpenYmax()

    bool Bnd_Box2d::IsOpenYmax ( ) const
    inlinenodiscardnoexcept

    Returns true if this bounding box is open in the Ymax direction.

    ◆ IsOpenYmin()

    bool Bnd_Box2d::IsOpenYmin ( ) const
    inlinenodiscardnoexcept

    Returns true if this bounding box is open in the Ymin direction.

    ◆ IsOut() [1/6]

    bool Bnd_Box2d::IsOut ( const Bnd_Box2d & Other) const
    nodiscard

    Returns True if <Box2d> is out <me>.

    ◆ IsOut() [2/6]

    bool Bnd_Box2d::IsOut ( const Bnd_Box2d & theOther,
    const gp_Trsf2d & theTrsf ) const
    inlinenodiscardnoexcept

    Returns True if transformed <Box2d> is out <me>.

    ◆ IsOut() [3/6]

    bool Bnd_Box2d::IsOut ( const gp_Lin2d & theL) const
    nodiscard

    Returns True if the line doesn't intersect the box.

    ◆ IsOut() [4/6]

    bool Bnd_Box2d::IsOut ( const gp_Pnt2d & P) const
    nodiscard

    Returns True if the 2d pnt.

    is out <me>.

    ◆ IsOut() [5/6]

    bool Bnd_Box2d::IsOut ( const gp_Pnt2d & theP0,
    const gp_Pnt2d & theP1 ) const
    nodiscard

    Returns True if the segment doesn't intersect the box.

    ◆ IsOut() [6/6]

    bool Bnd_Box2d::IsOut ( const gp_Trsf2d & T1,
    const Bnd_Box2d & Other,
    const gp_Trsf2d & T2 ) const
    inlinenodiscardnoexcept

    Compares a transformed bounding with a transformed bounding. The default implementation is to make a copy of <me> and <Other>, to transform them and to test.

    ◆ IsVoid()

    bool Bnd_Box2d::IsVoid ( ) const
    inlinenodiscardnoexcept

    Returns true if this 2D bounding box is empty (Void flag).

    ◆ IsWhole()

    bool Bnd_Box2d::IsWhole ( ) const
    inlinenodiscardnoexcept

    Returns true if this bounding box is infinite in all 4 directions (Whole Space flag).

    ◆ OpenXmax()

    void Bnd_Box2d::OpenXmax ( )
    inlinenoexcept

    The Box will be infinitely long in the Xmax direction.

    ◆ OpenXmin()

    void Bnd_Box2d::OpenXmin ( )
    inlinenoexcept

    The Box will be infinitely long in the Xmin direction.

    ◆ OpenYmax()

    void Bnd_Box2d::OpenYmax ( )
    inlinenoexcept

    The Box will be infinitely long in the Ymax direction.

    ◆ OpenYmin()

    void Bnd_Box2d::OpenYmin ( )
    inlinenoexcept

    The Box will be infinitely long in the Ymin direction.

    ◆ Set() [1/2]

    void Bnd_Box2d::Set ( const gp_Pnt2d & thePnt)
    inline

    Sets this 2D bounding box so that it bounds the point P. This involves first setting this bounding box to be void and then adding the point PThe rectangle bounds the point.

    .

    ◆ Set() [2/2]

    void Bnd_Box2d::Set ( const gp_Pnt2d & thePnt,
    const gp_Dir2d & theDir )
    inline

    Sets this 2D bounding box so that it bounds the half-line defined by point P and direction D, i.e. all points M defined by M=P+u*D, where u is greater than or equal to 0, are inside the bounding area. This involves first setting this 2D box to be void and then adding the half-line.

    ◆ SetGap()

    void Bnd_Box2d::SetGap ( const double Tol)
    inlinenoexcept

    Set the gap of this 2D bounding box to abs(Tol).

    ◆ SetVoid()

    void Bnd_Box2d::SetVoid ( )
    inlinenoexcept

    Sets this 2D bounding box so that it is empty. All points are outside a void box.

    ◆ SetWhole()

    void Bnd_Box2d::SetWhole ( )
    inlinenoexcept

    Sets this bounding box so that it covers the whole 2D space, i.e. it is infinite in all directions.

    ◆ SquareExtent()

    double Bnd_Box2d::SquareExtent ( ) const
    inlinenodiscardnoexcept

    Computes the squared diagonal of me.

    ◆ Transformed()

    Bnd_Box2d Bnd_Box2d::Transformed ( const gp_Trsf2d & T) const
    nodiscard

    Returns a bounding box which is the result of applying the transformation T to this bounding box. Warning Applying a geometric transformation (for example, a rotation) to a bounding box generally increases its dimensions. This is not optimal for algorithms which use it.

    ◆ Update() [1/2]

    void Bnd_Box2d::Update ( const double aXmin,
    const double aYmin,
    const double aXmax,
    const double aYmax )

    Enlarges this 2D bounding box, if required, so that it contains at least:

    • interval [ aXmin,aXmax ] in the "X Direction",
    • interval [ aYmin,aYmax ] in the "Y Direction"

    ◆ Update() [2/2]

    void Bnd_Box2d::Update ( const double X,
    const double Y )

    Adds a point of coordinates (X,Y) to this bounding box.


    The documentation for this class was generated from the following file: