Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
BoundingBox Class Reference

Inherits ScriptObject.

Public Member Functions

 BoundingBox ()
 
 BoundingBox (Vector a, Vector b)
 
 expandTo (Vector point)
 
 expandToBox (BoundingBox box)
 
VectorPair getRayIntersection (Vector origin, Vector direction, Vector expansion=Vector())
 

Static Public Member Functions

static Integer compare (BoundingBox box1, BoundingBox box2, Number tolerance)
 

Public Attributes

Vector lower
 
Vector upper
 

Detailed Description

3D bounding box specified by the lower and upper corners.

Constructor & Destructor Documentation

◆ BoundingBox() [1/2]

Initializes the bounding box and (0, 0, 0) -> (0, 0, 0).

◆ BoundingBox() [2/2]

BoundingBox ( Vector  a,
Vector  b 
)

Initializes the bounding box for the specified corners.

Parameters
aCorner of box.
bCorner of box.

Member Function Documentation

◆ compare()

static Integer compare ( BoundingBox  box1,
BoundingBox  box2,
Number  tolerance 
)
static

Compares two bounding boxes.

Parameters
box1First box to compare.
box2Second box to compare.
toleranceAn optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the bounding box coordinates to prior to comparison.
Returns
The return values are:
  • BOXES_ARE_DIFFERENT - The bounding boxes are different.
  • BOXES_ARE_SAME - The bounding boxes match at the same position and size.
  • BOXES_ARE_TRANSLATED - The bounding boxes have the same width and length but at a different position.
Since
r51870

◆ expandTo()

expandTo ( Vector  point)

Expands the bounding box to include the specified position.

◆ expandToBox()

expandToBox ( BoundingBox  box)

Expands the bounding box to include the specified bounding box.

◆ getRayIntersection()

VectorPair getRayIntersection ( Vector  origin,
Vector  direction,
Vector  expansion = Vector() 
)

Gets intersection between the bounding box and a ray.

Parameters
originOrigin point of the ray.
directionDirection vector of the ray. Should be non-zero.
expansionAdditional thickness added to the bounding box. Should be non-negative.
Returns
Pair of intersection points. First intersection point is where the ray enters the bounding box. Second point, where the ray exits from the bounding. If ray's origin is inside the bounding box, first point is equal to second. Returns null, if the ray does not intersect the bounding box.
Since
r45500

Member Data Documentation

◆ lower

Vector lower

The lower corner.

◆ upper

Vector upper

The upper corner.



Generated by Autodesk, Inc. 31 January 2025
Copyright (c) 2012-2025 by Autodesk, Inc.