Class BoundingBox

Represents the value of two points in a bounding box defined by the two extreme corner points. This box is therefore aligned to the world X, Y and Z axes.

Hierarchy

  • BoundingBox

Constructors

  • Creates a new bounding box from two corner points.

    Parameters

    • min: Point3d

      Point containing all the minimum coordinates (minX, minY, minZ).

    • max: Point3d

      Point containing all the maximum coordinates (maxX, maxY, maxZ).

    Returns BoundingBox

Properties

Max: Point3d

Gets or sets the point in the maximal corner.

Min: Point3d

Gets or sets the point in the minimal corner.

Accessors

  • get Area(): number
  • Gets the area of this BoundingBox. If a bounding box is invalid, the area is 0.

    Returns number

  • get Center(): Point3d
  • Gets the point in the center of the bounding box.

    Returns Point3d

  • get Diagonal(): Vector3d
  • Gets the diagonal vector of this BoundingBox. The diagonal connects the Min and Max points.

    Returns Vector3d

  • get IsDegenerate(): number
  • Determines whether a bounding box is degenerate (flat) in one or more directions. 0 = box is not degenerate; 1 = box is a rectangle (degenerate in one direction); 2 = box is a line (degenerate in two directions); 3 = box is a point (degenerate in three directions); 4 = box is not valid.

    Returns number

  • get IsValid(): boolean
  • Gets a value that indicates whether or not this bounding box is valid. Empty boxes are not valid, and neither are boxes with unset points.

    Returns boolean

  • get Volume(): number
  • Gets the volume of this BoundingBox. If a bounding box is invalid, the volume is 0.

    Returns number

  • get Empty(): BoundingBox
  • Gets an [Empty] bounding box. An Empty box is an invalid structure that has negative width.

    Returns BoundingBox

Methods

  • Finds the closest point on or in the bounding box.

    Returns

    The point on or in the box that is closest to the sample point.

    Parameters

    • testPoint: Point3d

      Sample point.

    • includeInterior: boolean = true

      If false, the point is projected onto the boundary faces only, otherwise the interior of the box is also taken into consideration. default true

    Returns Point3d

  • Determines whether this bounding box contains another bounding box.

    Returns

    If 'strict' is affirmative, true if the box is inside this bounding box; false if it is on the surface or outside. If 'strict' is negative, true if the point is on the surface or on the inside of the bounding box; otherwise false.

    Parameters

    • testBox: BoundingBox

      box to test.

    • strict: boolean = true

      f true, the box needs to be fully on the inside of the bounding box. I.e. coincident boxes will be considered 'outside'.

    Returns boolean

  • Tests a point for BoundingBox inclusion.

    Returns

    If 'strict' is affirmative, true if the point is inside this bounding box; false if it is on the surface or outside. If 'strict' is negative, true if the point is on the surface or on the inside of the bounding box; otherwise false.

    Parameters

    • testPoint: Point3d

      Point to test.

    • strict: boolean = true

      If true, the point needs to be fully on the inside of the BoundingBox. I.e. coincident points will be considered 'outside'.

    Returns boolean

  • Determines whether a boundingbox is equal to another boundingbox.

    Returns

    true if other has the same coordinates as this; otherwise false.

    Parameters

    Returns boolean

  • Finds the furthest point on or in the bounding box.

    Returns

    The point on or in the box that is furthest to the sample point.

    Parameters

    Returns Point3d

  • Gets one of the eight corners of the box.

    Returns

    The corner point.

    Parameters

    • minX: boolean

      true for the minimum on the X axis; false for the maximum.

    • minY: boolean

      true for the minimum on the Y axis; false for the maximum.

    • minZ: boolean

      true for the minimum on the Z axis; false for the maximum.

    Returns Point3d

  • Returns a new inflated box with custom amounts in all directions. Inflating with negative amounts may result in decreasing boxes. InValid boxes can not be inflated and will return a clone of itself.

    Returns

    A new inflated box or a clone of itself if it is invalid.

    Parameters

    • xAmount: number

      Amount to inflate this box in the x direction.

    • yAmount: number

      Amount to inflate this box in the y direction.

    • zAmount: number

      Amount to inflate this box in the z direction.

    Returns BoundingBox

  • Inflates the box with equal amounts in all directions. Inflating with negative amounts may result in decreasing boxes. InValid boxes can not be inflated and will return a clone of itself.

    Returns

    A new inflated box or a clone of itself if it is invalid.

    Parameters

    • amount: number

      Amount to inflate the box.

    Returns BoundingBox

  • Ensures that the box is defined in an increasing fashion along X, Y and Z axes.

    Returns void

  • Evaluates the bounding box with normalized parameters. The box has idealized side length of 1x1x1.

    Returns

    The point at the {tx, ty, tz} parameters.

    Parameters

    • tx: number

      Normalized (between 0 and 1 is inside the box) parameter along the X direction.

    • ty: number

      Normalized (between 0 and 1 is inside the box) parameter along the Y direction.

    • tz: number

      Normalized (between 0 and 1 is inside the box) parameter along the Z direction.

    Returns Point3d

  • Creates a bounding box to represent the union of itself and another box.

    Remarks

    If either this BoundingBox or the other BoundingBox is InValid, the Valid BoundingBox will be the only one included in the union.

    Returns

    Parameters

    Returns BoundingBox

  • override toString

    Returns string

  • Constructs a bounding box from numeric extremes.

    Returns

    A new bounding box.

    Parameters

    • minX: number

      Minimum X value.

    • minY: number

      Minimum Y value.

    • minZ: number

      Minimum Z value.

    • maxX: number

      Maximum X value.

    • maxY: number

      Maximum Y value.

    • maxZ: number

      Maximum Z value.

    Returns BoundingBox

  • Computes the intersection of two bounding boxes. Invalid boxes are ignored and will not affect the intersection. If both boxes are invalid, the union will return an empty boundingbox.

    Returns

    An intersected BoundingBox.

    Parameters

    Returns BoundingBox

  • Returns a new BoundingBox that represents the union of boxes a and b. Invalid boxes are ignored and will not affect the union. If both boxes are invalid, the union will return an empty boundingbox.

    Returns

    A unioned BoundingBox.

    Parameters

    Returns BoundingBox

Generated using TypeDoc