psychopy.tools.mathtools.fitBBox

psychopy.tools.mathtools.fitBBox(points, dtype=None)[source]

Fit an axis-aligned bounding box around points.

This computes the minimum and maximum extents for a bounding box to completely enclose points. Keep in mind the the output in bounds are axis-aligned and may not optimally fits the points (i.e. fits the points with the minimum required volume). However, this should work well enough for applications such as visibility testing (see ~psychopy.tools.viewtools.volumeVisible for more information..

Parameters
  • points (array_like) – Nx3 or Nx4 array of points to fit the bounding box to.

  • dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.

Returns

Extents (mins, maxs) as a 2x3 array.

Return type

ndarray

See also

computeBBoxCorners

Convert bounding box extents to corners.


Back to top