Cube¶
-
class
sknano.core.geometric_regions.
Cube
(center=None, a=1)[source] [edit on github][source]¶ Bases:
sknano.core.geometric_regions.Geometric3DRegion
Geometric3DRegion
for a cube.New in version 0.3.0.
Cube
represents the region \(\left\{\{c_i\pm\frac{a}{2}\}|a>0\forall i\in\{x,y,z\}\right\}\).Parameters: - center (array_like, optional) – The \((x,y,z)\) coordinate of the axis-aligned cube center \((c_x, c_y, c_z)\).
- a (float, optional) – Side length \(a\) of axis-aligned cube.
Notes
Calling
Cube
with no parameters is equivalent toCube
(center=[0, 0, 0], a=1)
.Attributes
a
Side length \(a\) of the axis-aligned cube. bounding_box
Bounding Cuboid
.center
Center point \((c_x, c_y, c_z)\) of axis-aligned cube. centroid
Alias for center
.fmtstr
Format string. 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
Cube
volume, \(V=a^3\).Methods
center_centroid
()Center centroid
on origin.contains
(point)Test region membership of point
inCube
.get_points
()Return list of points from GeometricRegion.points
andGeometricRegion.vectors
rotate
(**kwargs)Rotate GeometricRegion
points
andvectors
.todict
()Returns a dict
of theCube
constructor parameters.translate
(t[, fix_anchor_points])Translate GeometricRegion
points
andvectors
byVector
t
.Attributes Summary
a
Side length \(a\) of the axis-aligned cube. center
Center point \((c_x, c_y, c_z)\) of axis-aligned cube. centroid
Alias for center
.volume
Cube
volume, \(V=a^3\).Methods Summary
contains
(point)Test region membership of point
inCube
.todict
()Returns a dict
of theCube
constructor parameters.Attributes Documentation
-
a
¶ Side length \(a\) of the axis-aligned cube.
-
center
¶ Center point \((c_x, c_y, c_z)\) of axis-aligned cube.
Methods Documentation
-
contains
(point)[source] [edit on github][source]¶ Test region membership of
point
inCube
.Parameters: point (array_like) – Returns: True
ifpoint
is withinCube
,False
otherwiseReturn type: bool
Notes
A
point
\((p_x, p_y, p_z)\) is within the bounded region of a cube with center \((c_x, c_y, c_z)\) and side length \(a\) if the following is true:\[c_i-\frac{a}{2}\le p_i\le c_i+\frac{a}{2}\forall i\in \{x, y, z\}\]