Cuboid¶
-
class
sisl.shape.Cuboid(v, center=None)[source]¶ A cuboid/rectangular prism (P4)
- Parameters
- vfloat or (3,) or (3, 3)
vectors describing the cuboid, if only 3 the cuboid will be along the Euclidean vectors.
- center(3,), optional
the center of the cuboid. Defaults to the origo.
Examples
>>> shape = Cuboid([2, 2.2, 2]) >>> shape.within([0, 2.1, 0]) False >>> shape.within([0, 1.1, 0]) True
Attributes
The geometric center of the shape
The lengths of each of the vector that defines the cuboid
Return the origin of the Cuboid (lower-left corner)
Methods
__init__(self, v[, center])Initialize self.
copy(self)expand(self, length)Expand the cuboid by a constant value along side vectors
scale(self, scale)Scale the cuboid box size (center is retained)
set_center(self, center)Re-setting the center can sometimes be necessary
set_origo(self, origo)Re-setting the origo can sometimes be necessary
toCuboid(self)Return a copy of itself
toEllipsoid(self)Return an ellipsoid that encompass this cuboid
toSphere(self)Return a sphere that encompass this cuboid
volume(self)Return volume of Cuboid
within(self, other)Return
Trueif other is fully within selfwithin_index(self, other)Return indices of the other object which are contained in the shape
-
property
center¶ The geometric center of the shape
-
property
edge_length¶ The lengths of each of the vector that defines the cuboid
-
expand(self, length)[source]¶ Expand the cuboid by a constant value along side vectors
- Parameters
- lengthfloat or (3,)
the extension in Ang per cuboid vector.
-
property
origo¶ Return the origin of the Cuboid (lower-left corner)
-
scale(self, scale)[source]¶ Scale the cuboid box size (center is retained)
- Parameters
- scalefloat or (3,)
the scale parameter for each of the vectors defining the
Cuboid
-
within(self, other)¶ Return
Trueif other is fully within selfIf other is an array, an array will be returned for each of these.
- Parameters
- otherarray_like
the array/object that is checked for containment