Processing math: 100%

sknano.core.geometric_regions.Rectangle

class sknano.core.geometric_regions.Rectangle(pmin=None, pmax=None, xmin=0, ymin=0, xmax=1, ymax=1)[source][source]

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:

pmin, pmax : array_like, optional

The minimum and maximum 2D point coordinates of the axis-aligned rectangle from pmin=[xmin, ymin] to pmax=[xmax, ymax].

xmin, ymin : float, optional

The minimum (x,y) point of the axis-aligned rectangle.

xmax, ymax : float, optional

The maximum (x,y) point of the axis-aligned rectangle.

Notes

Rectangle represents the region {{x,y}|xminxxmaxyminyymax}

Calling Rectangle with no parameters is equivalent to Rectangle(pmin=[0, 0], pmax=[1, 1]).

Attributes

a Distance between xmaxxmin.
area Rectangle area, A=ab
b Distance between ymaxymin.
center Alias for centroid.
centroid Rectangle centroid, (cx,cy).
fmtstr Format string.
measure Alias for area, which is the measure of a 2D geometric region.
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 in Rectangle.
rotate([angle, axis, anchor_point, ...]) Rotate GeometricRegion points and vectors.
todict() Returns a dict of the Rectangle constructor parameters.
translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.