psychopy.tools.mathtools.computeBBoxCorners

psychopy.tools.mathtools.computeBBoxCorners(extents, dtype=None)[source]

Get the corners of an axis-aligned bounding box.

Parameters
  • extents (array_like) – 2x3 array indicating the minimum and maximum extents of the bounding box.

  • 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

8x4 array of points defining the corners of the bounding box.

Return type

ndarray

Examples

Compute the corner points of a bounding box:

minExtent = [-1, -1, -1]
maxExtent = [1, 1, 1]
corners = computeBBoxCorners([minExtent, maxExtent])

# [[ 1.  1.  1.  1.]
#  [-1.  1.  1.  1.]
#  [ 1. -1.  1.  1.]
#  [-1. -1.  1.  1.]
#  [ 1.  1. -1.  1.]
#  [-1.  1. -1.  1.]
#  [ 1. -1. -1.  1.]
#  [-1. -1. -1.  1.]]

Back to top