Rectangle¶
-
class
sknano.core.geometric_regions.
Rectangle
(pmin=None, pmax=None, xmin=0, ymin=0, xmax=1, ymax=1)[source] [edit on github][source]¶ Bases:
sknano.core.geometric_regions.Geometric2DRegion
Geometric2DRegion
for a rectangle.New in version 0.3.0.
Represents an axis-aligned bounded region from pmin=(xmin,ymin) to pmax=(xmax,ymax).
Parameters: - pmax (pmin,) – The minimum and maximum 2D point coordinates of the axis-aligned
rectangle from
pmin=[xmin, ymin]
topmax=[xmax, ymax]
. - ymin (xmin,) – The minimum (x,y) point of the axis-aligned rectangle.
- ymax (xmax,) – The maximum (x,y) point of the axis-aligned rectangle.
Notes
Rectangle
represents the region {{x,y}|xmin≤x≤xmax∧ymin≤y≤ymax}Calling
Rectangle
with no parameters is equivalent toRectangle
(pmin=[0, 0], pmax=[1, 1])
.Attributes
a
Alias for Rectangle.lx
.area
Rectangle
area, A=ℓxℓyb
Alias for Rectangle.ly
.bounding_box
Bounding Cuboid
.center
Alias for centroid
.centroid
Rectangle
centroid, (cx,cy).fmtstr
Format string. lengths
tuple
of side lengthslx
Distance between xmax−xmin. ly
Distance between ymax−ymin. measure
Alias for area
, which is the measure of a 2D geometric region.ndim
Return the dimensions. pmax
2D Point
at (xmax
,ymax
).pmin
2D Point
at (xmin
,ymin
).xmax
xmax coordinate. xmin
xmin coordinate. ymax
ymax coordinate. ymin
ymin coordinate. Methods
center_centroid
()Center centroid
on origin.contains
(point)Test region membership of point
inRectangle
.get_points
()Return list of points from GeometricRegion.points
andGeometricRegion.vectors
rotate
(**kwargs)Rotate GeometricRegion
points
andvectors
.todict
()Returns a dict
of theRectangle
constructor parameters.translate
(t[, fix_anchor_points])Translate GeometricRegion
points
andvectors
byVector
t
.Attributes Summary
a
Alias for Rectangle.lx
.area
Rectangle
area, A=ℓxℓyb
Alias for Rectangle.ly
.centroid
Rectangle
centroid, (cx,cy).lengths
tuple
of side lengthslx
Distance between xmax−xmin. ly
Distance between ymax−ymin. pmax
2D Point
at (xmax
,ymax
).pmin
2D Point
at (xmin
,ymin
).xmax
xmax coordinate. xmin
xmin coordinate. ymax
ymax coordinate. ymin
ymin coordinate. Methods Summary
contains
(point)Test region membership of point
inRectangle
.todict
()Returns a dict
of theRectangle
constructor parameters.Attributes Documentation
-
a
¶ Alias for
Rectangle.lx
.
-
b
¶ Alias for
Rectangle.ly
.
-
centroid
¶ Rectangle
centroid, (cx,cy).Computed as the 2D
Point
(cx,cy) with coordinates:cx=xmin+xmax2cy=ymin+ymax2Returns: 2D Point
of centroid.Return type: Point
-
lx
¶ Distance between xmax−xmin.
-
ly
¶ Distance between ymax−ymin.
-
xmax
¶ xmax coordinate.
-
xmin
¶ xmin coordinate.
-
ymax
¶ ymax coordinate.
-
ymin
¶ ymin coordinate.
Methods Documentation
-
contains
(point)[source] [edit on github][source]¶ Test region membership of
point
inRectangle
.Parameters: point (array_like) – Returns: True
ifpoint
is withinRectangle
,False
, otherwise.Return type: bool
Notes
A point (px,py) is within the bounded region of a rectangle with lower corner at pmin=(xmin,ymin) and upper corner at pmax=(xmax,ymax) if the following is true:
xmin≤x≤xmax∧ymin≤y≤ymax
- pmax (pmin,) – The minimum and maximum 2D point coordinates of the axis-aligned
rectangle from