Cuboid

class sknano.core.geometric_regions.Cuboid(pmin=None, pmax=None, xmin=0, ymin=0, zmin=0, xmax=1, ymax=1, zmax=1)[source] [edit on github][source]

Bases: sknano.core.geometric_regions.Geometric3DRegion

Geometric3DRegion for a cuboid.

New in version 0.3.0.

Represents an axis-aligned cuboid with lower corner \(p_{\mathrm{min}}= (x_{\mathrm{min}},y_{\mathrm{min}},z_{\mathrm{min}})\) and upper corner \(p_{\mathrm{max}}= (x_{\mathrm{max}},y_{\mathrm{max}},z_{\mathrm{max}})\).

Parameters:
  • pmax (pmin,) – The minimum and maximum 3D point coordinates of the axis-aligned cuboid from pmin=[xmin, ymin, zmin] to pmax=[xmax, ymax, zmax].
  • ymin, zmin (xmin,) – The minimum \((x, y, z)\) coordinates of the axis-aligned cuboid.
  • ymax, zmax (xmax,) – The maximum \((x, y, z)\) coordinates of the axis-aligned cuboid.

Notes

Cuboid represents the region \(\left\{\{x, y, z\}| x_{\mathrm{min}}\le x\le x_{\mathrm{max}}\land y_{\mathrm{min}}\le y\le y_{\mathrm{max}}\land z_{\mathrm{min}}\le z\le z_{\mathrm{max}}\right\}\)

Calling Cuboid with no parameters is equivalent to Cuboid(pmin=[0, 0, 0], pmax=[1, 1, 1]).

Attributes

a Alias for Cuboid.lx.
abc Alias for Cuboid.lengths.
b Alias for Cuboid.ly.
bounding_box Bounding Cuboid.
c Alias for Cuboid.lz.
center Alias for centroid.
centroid Cuboid centroid, \((c_x, c_y, c_z)\).
fmtstr Format string.
lengths tuple of side lengths
lx Distance between \(x_{\mathrm{max}}-x_{\mathrm{min}}\).
ly Distance between \(y_{\mathrm{max}}-y_{\mathrm{min}}\).
lz Distance between \(z_{\mathrm{max}}-z_{\mathrm{min}}\).
measure Alias for volume, which is the measure of a 3D geometric region.
ndim Return the dimensions.
pmax Point at maximum extent.
pmin Point at minimum extent.
volume Cuboid volume, \(V=\ell_x\ell_y\ell_z\).
xmax \(x_{\mathrm{max}}\) coordinate.
xmin \(x_{\mathrm{min}}\) coordinate.
ymax \(y_{\mathrm{max}}\) coordinate.
ymin \(y_{\mathrm{min}}\) coordinate.
zmax \(z_{\mathrm{max}}\) coordinate.
zmin \(z_{\mathrm{min}}\) coordinate.

Methods

center_centroid() Center centroid on origin.
contains(point) Test region membership of point in Cuboid.
get_points() Return list of points from GeometricRegion.points and GeometricRegion.vectors
rotate(**kwargs) Rotate GeometricRegion points and vectors.
todict() Returns a dict of the Cuboid constructor parameters.
translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.

Attributes Summary

a Alias for Cuboid.lx.
abc Alias for Cuboid.lengths.
b Alias for Cuboid.ly.
c Alias for Cuboid.lz.
centroid Cuboid centroid, \((c_x, c_y, c_z)\).
lengths tuple of side lengths
lx Distance between \(x_{\mathrm{max}}-x_{\mathrm{min}}\).
ly Distance between \(y_{\mathrm{max}}-y_{\mathrm{min}}\).
lz Distance between \(z_{\mathrm{max}}-z_{\mathrm{min}}\).
pmax Point at maximum extent.
pmin Point at minimum extent.
volume Cuboid volume, \(V=\ell_x\ell_y\ell_z\).
xmax \(x_{\mathrm{max}}\) coordinate.
xmin \(x_{\mathrm{min}}\) coordinate.
ymax \(y_{\mathrm{max}}\) coordinate.
ymin \(y_{\mathrm{min}}\) coordinate.
zmax \(z_{\mathrm{max}}\) coordinate.
zmin \(z_{\mathrm{min}}\) coordinate.

Methods Summary

contains(point) Test region membership of point in Cuboid.
todict() Returns a dict of the Cuboid constructor parameters.

Attributes Documentation

a

Alias for Cuboid.lx.

abc

Alias for Cuboid.lengths.

b

Alias for Cuboid.ly.

c

Alias for Cuboid.lz.

centroid

Cuboid centroid, \((c_x, c_y, c_z)\).

Computed as the 3D Point \((c_x, c_y, c_z)\) with coordinates:

\[c_x = \frac{x_{\mathrm{min}} + x_{\mathrm{max}}}{2}\]\[c_y = \frac{y_{\mathrm{min}} + y_{\mathrm{max}}}{2}\]\[c_z = \frac{z_{\mathrm{min}} + z_{\mathrm{max}}}{2}\]
Returns:3D Point of centroid.
Return type:Point
lengths

tuple of side lengths

lx

Distance between \(x_{\mathrm{max}}-x_{\mathrm{min}}\).

ly

Distance between \(y_{\mathrm{max}}-y_{\mathrm{min}}\).

lz

Distance between \(z_{\mathrm{max}}-z_{\mathrm{min}}\).

pmax

Point at maximum extent.

pmin

Point at minimum extent.

volume

Cuboid volume, \(V=\ell_x\ell_y\ell_z\).

xmax

\(x_{\mathrm{max}}\) coordinate.

xmin

\(x_{\mathrm{min}}\) coordinate.

ymax

\(y_{\mathrm{max}}\) coordinate.

ymin

\(y_{\mathrm{min}}\) coordinate.

zmax

\(z_{\mathrm{max}}\) coordinate.

zmin

\(z_{\mathrm{min}}\) coordinate.

Methods Documentation

contains(point)[source] [edit on github][source]

Test region membership of point in Cuboid.

Parameters:point (array_like) –
Returns:True if point is within Cuboid, False, otherwise.
Return type:bool

Notes

A point \((p_x, p_y, p_z)\) is within the bounded region of a cuboid with lower corner at \(p_{\mathrm{min}}= (x_{\mathrm{min}}, y_{\mathrm{min}}, z_{\mathrm{min}})\) and upper corner at \(p_{\mathrm{max}}= (x_{\mathrm{max}}, y_{\mathrm{max}}, z_{\mathrm{max}})\) if the following is true:

\[x_{\mathrm{min}}\le x\le x_{\mathrm{max}}\land\]\[y_{\mathrm{min}}\le y\le y_{\mathrm{max}}\land\]\[z_{\mathrm{min}}\le z\le z_{\mathrm{max}}\]
todict()[source] [edit on github][source]

Returns a dict of the Cuboid constructor parameters.