Parallelogram¶
-
class
sknano.core.geometric_regions.
Parallelogram
(o=None, u=None, v=None)[source] [edit on github][source]¶ Bases:
sknano.core.geometric_regions.Geometric2DRegion
Geometric2DRegion
for a parallelogram.New in version 0.3.0.
Represents a parallelogram with origin o=(ox,oy) and direction vectors u=(ux,uy) and v=(vx,vy).
Parameters: Notes
Parallelogram
represents the bounded region {o+λ1u+λ2v∈R2|0≤λi≤1}, where u and v have to be linearly independent.Calling
Paralleogram
with no parameters is equivalent toParallelogram
(o=[0, 0], u=[1, 0], v=[1, 1])
Attributes
area
Paralleogram
area, A=|u×v|.bounding_box
Bounding Cuboid
.center
Alias for centroid
.centroid
Paralleogram centroid, (cx,cy). fmtstr
Format string. measure
Alias for area
, which is the measure of a 2D geometric region.ndim
Return the dimensions. o
2D point coordinates (ox,oy) of origin. pmax
Point
at maximum extent.pmin
Point
at minimum extent.u
2D direction vector u=(ux,uy), with origin o
v
2D direction vector v=(vx,vy), with origin o
Methods
center_centroid
()Center centroid
on origin.contains
(point)Test region membership of point
inParallelogram
.get_points
()Return list of points from GeometricRegion.points
andGeometricRegion.vectors
rotate
(**kwargs)Rotate GeometricRegion
points
andvectors
.todict
()Returns a dict
of theParalleogram
constructor parameters.translate
(t[, fix_anchor_points])Translate GeometricRegion
points
andvectors
byVector
t
.Attributes Summary
area
Paralleogram
area, A=|u×v|.centroid
Paralleogram centroid, (cx,cy). o
2D point coordinates (ox,oy) of origin. u
2D direction vector u=(ux,uy), with origin o
v
2D direction vector v=(vx,vy), with origin o
Methods Summary
contains
(point)Test region membership of point
inParallelogram
.todict
()Returns a dict
of theParalleogram
constructor parameters.Attributes Documentation
-
area
¶ Paralleogram
area, A=|u×v|.Computed as:
A=|u×v|
-
centroid
¶ Paralleogram centroid, (cx,cy).
Computed as the 2D point (cx,cy) with coordinates:
cx=ox+ux+vx2cy=oy+uy+vy2where (ox,oy), (ux,uy), and (vx,vy) are the (x,y) coordinates of the origin o and (x,y) components of the direction vectors u and v, respectively.
Returns: 2D Point
of centroid.Return type: Point
-
o
¶ 2D point coordinates (ox,oy) of origin.
Returns: 2D Point
coordinates (ox,oy) of origin.Return type: Point
-
u
¶ 2D direction vector u=(ux,uy), with origin
o
-
v
¶ 2D direction vector v=(vx,vy), with origin
o
Methods Documentation
-
contains
(point)[source] [edit on github][source]¶ Test region membership of
point
inParallelogram
.Parameters: point (array_like) – Returns: True
ifpoint
is withinParalleogram
,False
otherwiseReturn type: bool
Notes
A
point
(px,py) is within the bounded region of a parallelogram with origin (ox,oy) and direction vectors u=(ux,uy) and v=(vx,vy) if the following is true:0≤(py−oy)vx+(ox−px)vyuyvx−uxvy≤1∧0≤(py−oy)ux+(ox−px)uyuxvy−uyvx≤1
-
todict
()[source] [edit on github][source]¶ Returns a
dict
of theParalleogram
constructor parameters.
-