Solids Features

Bounding Boxes

There may be the requirement to get certain information about a solid object, e.g. its position or size. For this, a solid has the following members:

  • solid.min_bbox()
  • solid.fast_bbox()

Both members return a selectbox that has the dimensions of the respective bounding box.

The minimum bounding box (see https://en.wikipedia.org/wiki/Minimum_bounding_box) is the smallest axis-aligned box that covers the solid completely. Please note that retrieving the minimum bounding box may lead to slight reductions of the script performance. If the bounding box is not required to be minimal you can use the fast_bbox member instead. This may also be true in cases when the fast bounding box equals the minimum bounding box.

The fast bounding box is a bounding box that is evaluated in short runtime but that is not necessarily the minimum bounding box of the solid. Nevertheless, in some cases the fast bounding box is guaranteed to be the minimum bounding box, e.g. when retrieving it from a freshly created mesh or primitive object.

The following example returns the width of a sphere in Y direction:

Example

solid s = sphere()
selectbox b = s.min_bbox()
echo( b.maxy - b.miny )

Output

1