# sknano.core.geometric_regions.Parallelogram¶

class sknano.core.geometric_regions.Parallelogram(o=None, u=None, v=None)[source][source]

Geometric2DRegion for a parallelogram.

New in version 0.3.0.

Represents a parallelogram with origin $$o=(o_x, o_y)$$ and direction vectors $$\mathbf{u}=(u_x, u_y)$$ and $$\mathbf{v}=(v_x, v_y)$$.

Parameters: o : array_like, optional Parallelogram origin. If None, it defaults to o=[0, 0]. u, v : array_like, optional Parallelogram direction vectors stemming from origin o. If None, then the default values are u=[1, 0] and v=[1, 1].

Notes

Parallelogram represents the bounded region $$\left \{o+\lambda_1\mathbf{u}+\lambda_2\mathbf{v}\in R^2 |0\le\lambda_i\le 1\right\}$$, where $$\mathbf{u}$$ and $$\mathbf{v}$$ have to be linearly independent.

Calling Paralleogram with no parameters is equivalent to Parallelogram(o=[0, 0], u=[1, 0], v=[1, 1])

Attributes

 area Paralleogram area, $$A=|\mathbf{u}\times\mathbf{v}|$$. center Alias for centroid. centroid Paralleogram centroid, $$(c_x, c_y)$$. fmtstr Format string. measure Alias for area, which is the measure of a 2D geometric region. o 2D point coordinates $$(o_x, o_y)$$ of origin. u 2D direction vector $$\mathbf{u}=(u_x, u_y)$$, with origin o v 2D direction vector $$\mathbf{v}=(v_x, v_y)$$, with origin o

Methods

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