Square¶
-
class
sknano.core.geometric_regions.
Square
(center=None, a=1)[source] [edit on github][source]¶ Bases:
sknano.core.geometric_regions.Geometric2DRegion
Geometric2DRegion
for a square.New in version 0.3.0.
Represents the axis-aligned bounded region with center (cx,cy) and side length a.
Parameters: - center (array_like, optional) – The center point coordinate (cx,cy) of the axis-aligned square.
- a (float, optional) – The side length a of the axis-aligned square.
Notes
Square
represents the region {{ci±a2}|a>0∀i∈{x,y}}.Calling
Square
with no parameters is equivalent toSquare
(center=[0, 0], a=1)
.Attributes
a
Side length a of the axis-aligned square. area
Square
area, A=a2.bounding_box
Bounding Cuboid
.center
Center point (cx,cy) of axis-aligned square. centroid
Alias for center
.fmtstr
Format string. measure
Alias for area
, which is the measure of a 2D geometric region.ndim
Return the dimensions. pmax
Point
at maximum extent.pmin
Point
at minimum extent.Methods
center_centroid
()Center centroid
on origin.contains
(point)Test region membership of point
inSquare
.get_points
()Return list of points from GeometricRegion.points
andGeometricRegion.vectors
rotate
(**kwargs)Rotate GeometricRegion
points
andvectors
.todict
()Returns a dict
of theSquare
constructor parameters.translate
(t[, fix_anchor_points])Translate GeometricRegion
points
andvectors
byVector
t
.Attributes Summary
a
Side length a of the axis-aligned square. area
Square
area, A=a2.center
Center point (cx,cy) of axis-aligned square. centroid
Alias for center
.Methods Summary
contains
(point)Test region membership of point
inSquare
.todict
()Returns a dict
of theSquare
constructor parameters.Attributes Documentation
-
a
¶ Side length a of the axis-aligned square.
-
center
¶ Center point (cx,cy) of axis-aligned square.
Methods Documentation
-
contains
(point)[source] [edit on github][source]¶ Test region membership of
point
inSquare
.Parameters: point (array_like) – Returns: True
ifpoint
is withinSquare
,False
otherwise.Return type: bool
Notes
A
point
(px,py) is within the bounded region of a square with center (cx,cy) and side length a if the following is true:ci−a2≤pi≤ci+a2∀i∈{x,y}