microstructpy.geometry.Box

class microstructpy.geometry.Box(**kwargs)[source]

Bases: microstructpy.geometry.n_box.NBox

This class contains a generic, 3D box. The position and dimensions of the box can be specified using any of the parameters below.

Without any parameters, this is a unit cube centered on the origin.

Parameters
  • side_lengths (list) – (optional) Side lengths.

  • center (list) – (optional) Center of box.

  • corner (list) – (optional) Bottom-left corner.

  • limits (list) – (optional) Bounds of box.

  • bounds (list) – (optional) Alias for limits.

plot(**kwargs)[source]

Plot the box.

This function adds an mpl_toolkits.mplot3d.art3d.Poly3DCollection to the current axes. The keyword arguments are passed through to the Poly3DCollection.

Parameters

**kwargs (dict) – Keyword arguments for Poly3DCollection.

within(points)

Test if points are within n-box.

This function tests whether a point or set of points are within the n-box. For the set of points, a list of booleans is returned to indicate which points are within the n-box.

Parameters

points (list or numpy.ndarray) – Point or list of points.

Returns

Flags set to True for points in geometry.

Return type

bool or numpy.ndarray

property bounds

(lower, upper) bounds of the box

Type

list

property corner

bottom-left corner

Type

list

property limits

(lower, upper) bounds of the box

Type

list

property n_dim

number of dimensions, 3

Type

int

property n_vol

area, volume of n-box

Type

float

property sample_limits

(lower, upper) bounds of the sampling region of the box

Type

list

property volume

volume of box, \(V=l_1 l_2 l_3\)

Type

float