sknano.core.geometric_regions.Square

class sknano.core.geometric_regions.Square(center=None, a=1)[source][source]

Geometric2DRegion for a square.

New in version 0.3.0.

Represents the axis-aligned bounded region with center \((c_x, c_y)\) and side length \(a\).

Parameters:

center : array_like, optional

The center point coordinate \((c_x, c_y)\) of the axis-aligned square.

a : float, optional

The side length \(a\) of the axis-aligned square.

Notes

Square represents the region \(\left\{\{c_i\pm\frac{a}{2}\}|a>0\forall i\in\{x,y\}\right\}\).

Calling Square with no parameters is equivalent to Square(center=[0, 0], a=1).

Attributes

a Side length \(a\) of the axis-aligned square.
area Square area, \(A=a^2\).
center Center point \((c_x, c_y)\) of axis-aligned square.
centroid Alias for center.
fmtstr Format string.
measure Alias for area, which is the measure of a 2D geometric region.

Methods

center_centroid() Center centroid on origin.
contains(point) Test region membership of point in Square.
rotate([angle, axis, anchor_point, ...]) Rotate GeometricRegion points and vectors.
todict() Returns a dict of the Square constructor parameters.
translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.