Shape¶
-
class
sisl.shape.Shape(center)[source]¶ Baseclass for all shapes. Logical operations are implemented on this class.
This class must be sub classed.
Also all the required methods are predefined although they issue an error if they are not implemented in the sub-classed class.
There are a few routines that are necessary when implementing an inherited class:
centerreturn the geometric center of the shape.
withinReturns a boolean array which defines whether a coordinate is within or outside the shape.
within_indexEquivalent to
within, however only the indices of those within are returned.copyCreate a new identical shape.
The minimal requirement a shape can have are the above attributes.
Subclassed shapes may have additional methods by which they are defined.
Any
Shapemay be used to construct other shapes by applying set operations. Currently implemented binary operators are:__or__/__add__: set union, either | or + operator (not or)__and__: set intersection, & operator (not and)__sub__: set complement, - operator__xor__: set disjunctive union, ^ operator- Parameters
- center(3,)
the center of the shape
Attributes
The geometric center of the shape
Methods
__init__(self, center)Initialize self.
scale(self, scale)Return a new Shape with a scaled size
toCuboid(self)Create a cuboid which is surely encompassing the full shape
toEllipsoid(self)Create an ellipsoid which is surely encompassing the full shape
toSphere(self)Create a sphere which is surely encompassing the full shape
within(self, other)Return
Trueif other is fully within selfwithin_index(self, other)Return indices of the elements of other that are within the shape
-
property
center¶ The geometric center of the shape