OpenCascade.js
API ReferenceFoundationClassesTKMath

Bnd

OCCT package Bnd: Bnd_BoundSortBox, Bnd_Box, Bnd_Box2d, Bnd_OBB, and 3 more bound classes.

Bnd_BoundSortBox

A tool to compare a bounding box or a plane with a set of bounding boxes. It sorts the set of bounding boxes to give the list of boxes which intersect the element being compared. The boxes being sorted generally bound a set of shapes, while the box being compared bounds a shape to be compared. The resulting list of intersecting boxes therefore gives the list of items which potentially intersect the shape to be compared. How to use this class:

  • Create an instance of this class.
  • Initialize it with the set of boxes to be sorted using one of the Initialize() methods.
  • Call the Compare() method with the box or plane to be compared. Compare() will return the list of indices of the boxes which intersect the box or plane passed as argument.

Constructors(1)

  • Constructs an empty comparison algorithm for bounding boxes. The bounding boxes are then defined using the Initialize function.

Instance methods(6)

  • Initializes this comparison algorithm with the set of boxes.

    Parameters (1)
    • theSetOfBoxes
      The set of bounding boxes to be used by this algorithm.
  • Initialize(theEnclosingBox: Bnd_Box, theSetOfBoxes: NCollection_HArray1_Bnd_Box): void

    Initializes this comparison algorithm with the set of boxes and the bounding box that encloses all those boxes. This version of initialization can be used if complete box is known in advance to avoid calculating it again inside the algorithm.

    Parameters (2)
    • theEnclosingBox
      The bounding box that contains all the boxes in theSetOfBoxes.
    • theSetOfBoxes
      The set of bounding boxes to be used by this algorithm.
  • Initialize(theEnclosingBox: Bnd_Box, theNbBoxes: number): void

    Initializes this comparison algorithm with the bounding box that encloses all the boxes that will be used by this algorithm. and the expected number of those boxes. Boxes to be considered can then be added using the Add() method.

    Parameters (2)
    • theEnclosingBox
      The bounding box that contains all the boxes to be sorted.
    • theNbBoxes
  • Add(theBox: Bnd_Box, theIndex: number): void

    Adds the bounding box theBox at position boxIndex in the internal array of boxes to be sorted by this comparison algorithm. This function is used only in conjunction with the Initialize(const Bnd_Box&, const int) method. Exceptions:

    • Standard_OutOfRange if boxIndex is not in the range [ 1,nbComponents ] where nbComponents is the maximum number of bounding boxes declared for this algorithm at initialization.
    • Standard_MultiplyDefined if a box already exists at position theIndex in the internal array of boxes.
    Parameters (2)
    • theBox
      The bounding box to be added.
    • theIndex
      The index of the bounding box in the internal array where the box will be added. The index is 1-based.
  • Compares the bounding box theBox, with the set of bounding boxes provided to this algorithm at initialization, and returns the list of indices of bounding boxes that intersect the theBox or are inside it. The indices correspond to the indices of the bounding boxes in the array provided to this algorithm at initialization.

    Parameters (1)
    • theBox
      The bounding box to be compared.
    Returns

    The list of indices of bounding boxes that intersect the bounding box theBox or are inside it.

  • Compares the plane thePlane with the set of bounding boxes provided to this algorithm at initialization, and returns the list of indices of bounding boxes that intersect the thePlane. The indices correspond to the indices of the bounding boxes in the array provided to this algorithm at initialization.

    Parameters (1)
    • thePlane
      The plane to be compared.
    Returns

    The list of indices of bounding boxes that intersect the plane thePlane.

Bnd_Box

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

  • [ Xmin,Xmax ],
  • [ Ymin,Ymax ],
  • [ Zmin,Zmax ]. 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";
  • OpenZmin if it is infinite on the negative side of the "Z Direction";
  • OpenZmax if it is infinite on the positive side of the "Z Direction";
  • WholeSpace if it is infinite in all six 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:
  • six bounds (Xmin, Xmax, Ymin, Ymax, Zmin and Zmax) which limit the bounding box if it is finite,
  • eight flags (OpenXmin, OpenXmax, OpenYmin, OpenYmax, OpenZmin, OpenZmax, 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.

Constructors(2)

  • Creates an empty Box. The constructed box is qualified Void. Its gap is null.

  • constructor(theMin: gp_Pnt, theMax: gp_Pnt): Bnd_Box

    Creates a bounding box, it contains:

    • minimum/maximum point of bounding box, The constructed box is qualified Void. Its gap is null.
    Parameters (2)
    • theMin
    • theMax

Instance methods(55)

  • SetWhole(): void

    Sets this bounding box so that it covers the whole of 3D space. It is infinitely long in all directions.

  • SetVoid(): void

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

  • Set(P: gp_Pnt): void

    Sets this bounding box so that it bounds.

    • the point P. This involves first setting this bounding box to be void and then adding the point P.
    Parameters (1)
    • P
  • Set(P: gp_Pnt, D: gp_Dir): void

    Sets this 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 volume. This involves first setting this box to be void and then adding the half-line.

    Parameters (2)
    • P
    • D
  • Update(aXmin: number, aYmin: number, aZmin: number, aXmax: number, aYmax: number, aZmax: number): void

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

    • interval [ aXmin,aXmax ] in the "X Direction",
    • interval [ aYmin,aYmax ] in the "Y Direction",
    • interval [ aZmin,aZmax ] in the "Z Direction";
    Parameters (6)
    • aXmin
    • aYmin
    • aZmin
    • aXmax
    • aYmax
    • aZmax
  • Update(X: number, Y: number, Z: number): void

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

    Parameters (3)
    • X
    • Y
    • Z
  • SetGap(Tol: number): void

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

    Parameters (1)
    • Tol
  • Enlarge(Tol: number): void

    Enlarges the box with a tolerance value. (minvalues-std::abs(<tol>) and maxvalues+std::abs(<tol>)) This means that the minimum values of its X, Y and Z 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.

    Parameters (1)
    • Tol
  • GetXMin(): number

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

  • GetXMax(): number

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

  • GetYMin(): number

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

  • GetYMax(): number

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

  • GetZMin(): number

    Returns the Zmin value (IsOpenZmin() ? -Precision::Infinite() : Zmin - GetGap()).

  • GetZMax(): number

    Returns the Zmax value (IsOpenZmax() ? Precision::Infinite() : Zmax + GetGap()).

  • Returns the lower corner of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid().

  • Returns the upper corner of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid().

  • Center(): gp_Pnt | null | undefined

    Returns the center of this 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.

  • OpenXmin(): void

    The Box will be infinitely long in the Xmin direction.

  • OpenXmax(): void

    The Box will be infinitely long in the Xmax direction.

  • OpenYmin(): void

    The Box will be infinitely long in the Ymin direction.

  • OpenYmax(): void

    The Box will be infinitely long in the Ymax direction.

  • OpenZmin(): void

    The Box will be infinitely long in the Zmin direction.

  • OpenZmax(): void

    The Box will be infinitely long in the Zmax direction.

  • IsOpen(): boolean

    Returns true if this bounding box has at least one open direction.

  • IsOpenXmin(): boolean

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

  • IsOpenXmax(): boolean

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

  • IsOpenYmin(): boolean

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

  • IsOpenYmax(): boolean

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

  • IsOpenZmin(): boolean

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

  • IsOpenZmax(): boolean

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

  • IsWhole(): boolean

    Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag).

  • IsVoid(): boolean

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

  • IsXThin(tol: number): boolean

    true if xmax-xmin < tol.

    Parameters (1)
    • tol
  • IsYThin(tol: number): boolean

    true if ymax-ymin < tol.

    Parameters (1)
    • tol
  • IsZThin(tol: number): boolean

    true if zmax-zmin < tol.

    Parameters (1)
    • tol
  • IsThin(tol: number): boolean

    Returns true if IsXThin, IsYThin and IsZThin are all true, i.e. if the box is thin in all three dimensions.

    Parameters (1)
    • tol
  • 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.

    Parameters (1)
    • T
  • Add(Other: Bnd_Box): void

    Adds the box <Other> to <me>.

    Parameters (1)
    • Other
  • Add(P: gp_Pnt): void

    Adds a Pnt to the box.

    Parameters (1)
    • P
  • Add(D: gp_Dir): void

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

    Parameters (1)
    • D
  • Add(P: gp_Pnt, D: gp_Dir): void

    Extends <me> from the Pnt.
    in the direction <D>.

    Parameters (2)
    • P
    • D
  • IsOut(P: gp_Pnt): boolean

    Returns True if the Pnt is out the box.

    Parameters (1)
    • P
  • IsOut(L: gp_Lin): boolean

    Returns False if the line intersects the box.

    Parameters (1)
    • L
  • IsOut(P: gp_Pln): boolean

    Returns False if the plane intersects the box.

    Parameters (1)
    • P
  • IsOut(Other: Bnd_Box): boolean

    Returns False if the <Box> intersects or is inside <me>.

    Parameters (1)
    • Other
  • IsOut(Other: Bnd_Box, T: gp_Trsf): boolean

    Returns False if the transformed <Box> intersects or is inside <me>.

    Parameters (2)
    • Other
    • T
  • IsOut(T1: gp_Trsf, Other: Bnd_Box, T2: gp_Trsf): boolean

    Returns False if the transformed <Box> intersects or is inside the transformed box <me>.

    Parameters (3)
    • T1
    • Other
    • T2
  • IsOut(P1: gp_Pnt, P2: gp_Pnt, D: gp_Dir): boolean

    Returns False if the flat band lying between two parallel lines represented by their reference points <P1>, <P2> and direction <D> intersects the box.

    Parameters (3)
    • P1
    • P2
    • D
  • Contains(theP: gp_Pnt): boolean

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

    Parameters (1)
    • theP
  • Intersects(theOther: Bnd_Box): boolean

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

    Parameters (1)
    • theOther
  • Distance(Other: Bnd_Box): number

    Computes the minimum distance between two boxes.

    Parameters (1)
    • Other
  • Dump(): void
  • SquareExtent(): number

    Computes the squared diagonal of me.

  • Returns a finite part of an infinite bounding box (returns self if this is already finite box). This can be a Void box in case if its sides has been defined as infinite (Open) without adding any finite points. WARNING! This method relies on Open flags, the infinite points added using Add() method will be returned as is.

  • HasFinitePart(): boolean

    Returns TRUE if this box has finite part.

Bnd_Box2d

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.

Constructors(1)

Instance methods(39)

  • SetWhole(): void

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

  • SetVoid(): void

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

  • Set(thePnt: gp_Pnt2d): void

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

    Parameters (1)
    • thePnt
  • Set(thePnt: gp_Pnt2d, theDir: gp_Dir2d): void

    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.

    Parameters (2)
    • thePnt
    • theDir
  • Update(aXmin: number, aYmin: number, aXmax: number, aYmax: number): void

    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"
    Parameters (4)
    • aXmin
    • aYmin
    • aXmax
    • aYmax
  • Update(X: number, Y: number): void

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

    Parameters (2)
    • X
    • Y
  • SetGap(Tol: number): void

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

    Parameters (1)
    • Tol
  • Enlarge(theTol: number): void

    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.

    Parameters (1)
    • theTol
  • GetXMin(): number

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

  • GetXMax(): number

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

  • GetYMin(): number

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

  • GetYMax(): number

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

  • Center(): gp_Pnt2d | null | undefined

    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.

  • OpenXmin(): void

    The Box will be infinitely long in the Xmin direction.

  • OpenXmax(): void

    The Box will be infinitely long in the Xmax direction.

  • OpenYmin(): void

    The Box will be infinitely long in the Ymin direction.

  • OpenYmax(): void

    The Box will be infinitely long in the Ymax direction.

  • IsOpenXmin(): boolean

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

  • IsOpenXmax(): boolean

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

  • IsOpenYmin(): boolean

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

  • IsOpenYmax(): boolean

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

  • IsWhole(): boolean

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

  • IsVoid(): boolean

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

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

    Parameters (1)
    • T
  • Add(Other: Bnd_Box2d): void

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

    Parameters (1)
    • Other
  • Add(thePnt: gp_Pnt2d): void

    Adds the 2d point.

    Parameters (1)
    • thePnt
  • Add(D: gp_Dir2d): void

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

    Parameters (1)
    • D
  • Add(thePnt: gp_Pnt2d, theDir: gp_Dir2d): void

    Extends bounding box from thePnt in the direction theDir.

    Parameters (2)
    • thePnt
    • theDir
  • IsOut(P: gp_Pnt2d): boolean

    Returns True if the 2d pnt.
    is out <me>.

    Parameters (1)
    • P
  • IsOut(theL: gp_Lin2d): boolean

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

    Parameters (1)
    • theL
  • IsOut(Other: Bnd_Box2d): boolean

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

    Parameters (1)
    • Other
  • IsOut(theP0: gp_Pnt2d, theP1: gp_Pnt2d): boolean

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

    Parameters (2)
    • theP0
    • theP1
  • IsOut(theOther: Bnd_Box2d, theTrsf: gp_Trsf2d): boolean

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

    Parameters (2)
    • theOther
    • theTrsf
  • IsOut(T1: gp_Trsf2d, Other: Bnd_Box2d, T2: gp_Trsf2d): boolean

    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.

    Parameters (3)
    • T1
    • Other
    • T2
  • Contains(theP: gp_Pnt2d): boolean

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

    Parameters (1)
    • theP
  • Intersects(theOther: Bnd_Box2d): boolean

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

    Parameters (1)
    • theOther
  • Distance(theOther: Bnd_Box2d): number

    Computes the minimum distance between two 2D boxes.

    Parameters (1)
    • theOther
  • Dump(): void
  • SquareExtent(): number

    Computes the squared diagonal of me.

Bnd_OBB

The class describes the Oriented Bounding Box (OBB), much tighter enclosing volume for the shape than the Axis Aligned Bounding Box (AABB). The OBB is defined by a center of the box, the axes and the halves of its three dimensions. The OBB can be used more effectively than AABB as a rejection mechanism for non-interfering objects.

Constructors(3)

  • Empty constructor.

  • Constructor to create OBB from AABB.

    Parameters (1)
    • theBox
  • constructor(theCenter: gp_Pnt, theXDirection: gp_Dir, theYDirection: gp_Dir, theZDirection: gp_Dir, theHXSize: number, theHYSize: number, theHZSize: number): Bnd_OBB

    Constructor taking all defining parameters.

    Parameters (7)
    • theCenter
    • theXDirection
    • theYDirection
    • theZDirection
    • theHXSize
    • theHYSize
    • theHZSize

Instance methods(28)

  • ReBuild(theListOfPoints: NCollection_Array1_gp_Pnt, theListOfTolerances?: NCollection_Array1_double, theIsOptimal?: boolean): void

    Creates new OBB covering every point in theListOfPoints. Tolerance of every such point is set by *theListOfTolerances array. If this array is not void (not null-pointer) then the resulted Bnd_OBB will be enlarged using tolerances of points lying on the box surface. <theIsOptimal> flag defines the mode in which the OBB will be built. Constructing Optimal box takes more time, but the resulting box is usually more tight. In case of construction of Optimal OBB more possible axes are checked.

    Parameters (3)
    • theListOfPoints
    • theListOfTolerances
    • theIsOptimal
  • SetCenter(theCenter: gp_Pnt): void

    Sets the center of OBB.

    Parameters (1)
    • theCenter
  • SetXComponent(theXDirection: gp_Dir, theHXSize: number): void

    Sets the X component of OBB - direction and size.

    Parameters (2)
    • theXDirection
    • theHXSize
  • SetYComponent(theYDirection: gp_Dir, theHYSize: number): void

    Sets the Y component of OBB - direction and size.

    Parameters (2)
    • theYDirection
    • theHYSize
  • SetZComponent(theZDirection: gp_Dir, theHZSize: number): void

    Sets the Z component of OBB - direction and size.

    Parameters (2)
    • theZDirection
    • theHZSize
  • Returns the local coordinates system of this oriented box. So that applying it to axis-aligned box ((-XHSize, -YHSize, -ZHSize), (XHSize, YHSize, ZHSize)) will produce this oriented box.

    gp_TrsfaLoc; aLoc.SetTransformation(theOBB.Position(),gp::XOY());
  • Returns the center of OBB.

  • Returns the X Direction of OBB.

  • Returns the Y Direction of OBB.

  • Returns the Z Direction of OBB.

  • XHSize(): number

    Returns the X Dimension of OBB.

  • YHSize(): number

    Returns the Y Dimension of OBB.

  • ZHSize(): number

    Returns the Z Dimension of OBB.

  • GetHalfSizes(): Bnd_OBB_HalfSizes

    Returns the half-size dimensions of the OBB as a HalfSizes structure. Can be used with C++17 structured bindings:

    auto[aHX,aHY,aHZ]=anOBB.GetHalfSizes();
  • IsVoid(): boolean

    Checks if the box is empty.

  • SetVoid(): void

    Clears this box.

  • SetAABox(theFlag: boolean): void

    Sets the flag for axes aligned box.

    Parameters (1)
    • theFlag
  • IsAABox(): boolean

    Returns TRUE if the box is axes aligned.

  • Enlarge(theGapAdd: number): void

    Enlarges the box with the given value.

    Parameters (1)
    • theGapAdd
  • Returns the array of vertices in <this>. The local coordinate of the vertex depending on the index of the array are follow: Index == 0: (-XHSize(), -YHSize(), -ZHSize()) Index == 1: ( XHSize(), -YHSize(), -ZHSize()) Index == 2: (-XHSize(), YHSize(), -ZHSize()) Index == 3: ( XHSize(), YHSize(), -ZHSize()) Index == 4: (-XHSize(), -YHSize(), ZHSize()) Index == 5: ( XHSize(), -YHSize(), ZHSize()) Index == 6: (-XHSize(), YHSize(), ZHSize()) Index == 7: ( XHSize(), YHSize(), ZHSize()).

    Parameters (1)
    • theP
  • SquareExtent(): number

    Returns square diagonal of this box.

  • IsOut(theOther: Bnd_OBB): boolean

    Check if the box do not interfere the other box.

    Parameters (1)
    • theOther
  • IsOut(theP: gp_Pnt): boolean

    Check if the point is inside of <this>.

    Parameters (1)
    • theP
  • Contains(theP: gp_Pnt): boolean

    Returns True if the point is inside or on the boundary of this OBB.

    Parameters (1)
    • theP
  • Intersects(theOther: Bnd_OBB): boolean

    Returns True if the other OBB intersects or is inside this OBB.

    Parameters (1)
    • theOther
  • IsCompletelyInside(theOther: Bnd_OBB): boolean

    Check if the theOther is completely inside *this.

    Parameters (1)
    • theOther
  • Add(theOther: Bnd_OBB): void

    Rebuilds this in order to include all previous objects (which it was created from) and theOther.

    Parameters (1)
    • theOther
  • Add(theP: gp_Pnt): void

    Rebuilds this in order to include all previous objects (which it was created from) and theP.

    Parameters (1)
    • theP

Bnd_Range

This class describes a range in 1D space restricted by two real values. A range can be void indicating there is no point included in the range.

Constructors(2)

Instance methods(26)

  • Common(theOther: Bnd_Range): void

    Replaces <this> with common-part of <this> and theOther.

    Parameters (1)
    • theOther
  • Union(theOther: Bnd_Range): boolean

    Joins *this and theOther to one interval. Replaces *this to the result. Returns false if the operation cannot be done (e.g. input arguments are empty or separated).

    Parameters (1)
    • theOther
    See also
    • use method ::Add() to merge two ranges unconditionally
  • Split(theVal: number, theList: NCollection_List_Bnd_Range, thePeriod: number): void

    Splits <this> to several sub-ranges by theVal value (e.g. range [3, 15] will be split by theVal==5 to the two ranges: [3, 5] and [5, 15]). New ranges will be pushed to theList (theList must be initialized correctly before calling this method). If thePeriod != 0.0 then at least one boundary of new ranges (if <this> intersects theVal+kthePeriod) will be equal to theVal+thePeriod*k, where k is an integer number (k = 0, +/-1, +/-2, ...). (let thePeriod in above example be 4 ==> we will obtain four ranges: [3, 5], [5, 9], [9, 13] and [13, 15].

    Parameters (3)
    • theVal
    • theList
      Mutated in place; read the updated value from this argument after the call.
    • thePeriod
  • IsIntersected(theVal: number, thePeriod?: number): Bnd_Range_IntersectStatus

    Checks if <this> intersects values like theVal+k*thePeriod, where k is an integer number (k = 0, +/-1, +/-2, ...).
    ATTENTION!!! If (myFirst == myLast) then this function will return only either Out or Boundary.

    Parameters (2)
    • theVal
    • thePeriod
  • Add(theParameter: number): void

    Extends <this> to include theParameter.

    Parameters (1)
    • theParameter
  • Add(theRange: Bnd_Range): void

    Extends this range to include both ranges.

    Parameters (1)
    • theRange
    See also
    • use method ::Union() to check if two ranges overlap method merging
  • GetMin(thePar: number): { returnValue: boolean; thePar: number }

    Obtain MIN boundary of <this>. If <this> is VOID the method returns false.

    Parameters (1)
    • thePar
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • thePar: updated value from the call.
  • GetMax(thePar: number): { returnValue: boolean; thePar: number }

    Obtain MAX boundary of <this>. If <this> is VOID the method returns false.

    Parameters (1)
    • thePar
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • thePar: updated value from the call.
  • GetBounds(theFirstPar: number, theLastPar: number): { returnValue: boolean; theFirstPar: number; theLastPar: number }

    Obtain first and last boundary of <this>. If <this> is VOID the method returns false.

    Parameters (2)
    • theFirstPar
    • theLastPar
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theFirstPar: updated value from the call.
    • theLastPar: updated value from the call.
  • Get(): Bnd_Range_Bounds | null | undefined

    Returns the bounds of this range as a Bounds structure. Returns std::nullopt if IsVoid(). Can be used with C++17 structured bindings:

    if(autoaBounds=aRange.Get()) { auto[aMin,aMax]=*aBounds; }
  • GetIntermediatePoint(theLambda: number, theParameter: number): { returnValue: boolean; theParameter: number }

    Obtain theParameter satisfied to the equation (theParameter-MIN)/(MAX-MIN) == theLambda.

    • theLambda == 0 --> MIN boundary will be returned;
    • theLambda == 0.5 --> Middle point will be returned;
    • theLambda == 1 --> MAX boundary will be returned;
    • theLambda < 0 --> the value less than MIN will be returned;
    • theLambda > 1 --> the value greater than MAX will be returned. If <this> is VOID the method returns false.
    Parameters (2)
    • theLambda
    • theParameter
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theParameter: updated value from the call.
  • Center(): number | null | undefined

    Returns the center of this range ((Min + Max) / 2). Returns std::nullopt if IsVoid().

  • Delta(): number

    Returns range value (MAX-MIN). Returns negative value for VOID range.

  • IsVoid(): boolean

    Is <this> initialized.

  • SetVoid(): void

    Initializes <this> by default parameters. Makes <this> VOID.

  • Enlarge(theDelta: number): void

    Extends this to the given value (in both side).

    Parameters (1)
    • theDelta
  • Shifted(theVal: number): Bnd_Range

    Returns the copy of <*this> shifted by theVal.

    Parameters (1)
    • theVal
  • Shift(theVal: number): void

    Shifts <*this> by theVal.

    Parameters (1)
    • theVal
  • TrimFrom(theValLower: number): void

    Trims the First value in range by the given lower limit. Marks range as Void if the given Lower value is greater than range Max.

    Parameters (1)
    • theValLower
  • TrimTo(theValUpper: number): void

    Trim the Last value in range by the given Upper limit. Marks range as Void if the given Upper value is smaller than range Max.

    Parameters (1)
    • theValUpper
  • IsOut(theValue: number): boolean

    Returns True if the value is out of this range.

    Parameters (1)
    • theValue
  • IsOut(theRange: Bnd_Range): boolean

    Returns True if the given range is out of this range.

    Parameters (1)
    • theRange
  • Contains(theValue: number): boolean

    Returns True if the value is within this range.

    Parameters (1)
    • theValue
  • Intersects(theRange: Bnd_Range): boolean

    Returns True if the given range intersects (overlaps with) this range.

    Parameters (1)
    • theRange
  • Min(): number | null | undefined

    Returns the MIN boundary of <this>. Returns std::nullopt if IsVoid().

  • Max(): number | null | undefined

    Returns the MAX boundary of <this>. Returns std::nullopt if IsVoid().

Bnd_Sphere

This class represents a bounding sphere of a geometric entity (triangle, segment of line or whatever else).

Constructors(2)

Instance methods(15)

  • U(): number

    Returns the U parameter on shape.

  • V(): number

    Returns the V parameter on shape.

  • IsValid(): boolean

    Returns validity status, indicating that this sphere corresponds to a real entity.

  • SetValid(isValid: boolean): void
    Parameters (1)
    • isValid
  • Returns center of sphere object.

  • Radius(): number

    Returns the radius value.

  • Distances(theXYZ: gp_XYZ, theMin: number, theMax: number): { theMin: number; theMax: number }

    Calculate and return minimal and maximal distance to sphere. NOTE: This function is tightly optimized; any modifications may affect performance!

    Parameters (3)
    • theXYZ
    • theMin
    • theMax
    Returns

    A result object with fields:

    • theMin: updated value from the call.
    • theMax: updated value from the call.
  • SquareDistances(theXYZ: gp_XYZ, theMin: number, theMax: number): { theMin: number; theMax: number }

    Calculate and return minimal and maximal distance to sphere. NOTE: This function is tightly optimized; any modifications may affect performance!

    Parameters (3)
    • theXYZ
    • theMin
    • theMax
    Returns

    A result object with fields:

    • theMin: updated value from the call.
    • theMax: updated value from the call.
  • Project(theNode: gp_XYZ, theProjNode: gp_XYZ, theDist: number, theInside: boolean): { returnValue: boolean; theDist: number; theInside: boolean }

    Projects a point on entity. Returns true if success.

    Parameters (4)
    • theNode
    • theProjNode
      Mutated in place; read the updated value from this argument after the call.
    • theDist
    • theInside
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theDist: updated value from the call.
    • theInside: updated value from the call.
  • Distance(theNode: gp_XYZ): number
    Parameters (1)
    • theNode
  • SquareDistance(theNode: gp_XYZ): number
    Parameters (1)
    • theNode
  • Add(theOther: Bnd_Sphere): void
    Parameters (1)
    • theOther
  • IsOut(theOther: Bnd_Sphere): boolean
    Parameters (1)
    • theOther
  • IsOut(thePnt: gp_XYZ, theMaxDist: number): { returnValue: boolean; theMaxDist: number }
    Parameters (2)
    • thePnt
    • theMaxDist
  • SquareExtent(): number