Parallelepiped

class sknano.core.geometric_regions.Parallelepiped(o=None, u=None, v=None, w=None)[source] [edit on github][source]

Bases: sknano.core.geometric_regions.Geometric3DRegion

Geometric3DRegion for a parallelepiped.

New in version 0.3.0.

Represents a parallelepiped with origin \((o_x, o_y, o_z)\) and direction vectors \(\mathbf{u}=(u_x, u_y, u_z)\), \(\mathbf{v}=(v_x, v_y, v_z)\), and \(\mathbf{w}=(w_x, w_y, w_z)\).

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

Notes

Parallelepiped represents the bounded region \(\left\{o+\lambda_1\mathbf{u}+\lambda_2\mathbf{v}+ \lambda_3\mathbf{w}\in R^3|0\le\lambda_i\le 1\right\}\), where \(\mathbf{u}\), \(\mathbf{v}\), and \(\mathbf{w}\) have to be linearly independent.

Calling Parallelepiped with no parameters is equivalent to Parallelepiped(o=[0, 0, 0], u=[1, 0, 0], v=[1, 1, 0], w=[0, 1, 1]).

Attributes

a Alias for Parallelepiped.u.length.
abc Alias for Parallelepiped.lengths.
b Alias for Parallelepiped.v.length.
bounding_box Bounding Cuboid.
c Alias for Parallelepiped.w.length.
center Alias for centroid.
centroid Parallelepiped centroid, \((c_x, c_y, c_z)\).
fmtstr Format string.
lengths tuple of side lengths
measure Alias for volume, which is the measure of a 3D geometric region.
ndim Return the dimensions.
o 3D point coordinates \((o_x, o_y, o_z)\) of origin.
pmax Point at maximum extent.
pmin Point at minimum extent.
u 3D direction vector \(\mathbf{u}=(u_x, u_y, u_z)\), with origin o
v 3D direction vector \(\mathbf{v}=(v_x, v_y, v_z)\), with origin o
volume Parallelepiped volume, \(V\).
w 3D direction vector \(\mathbf{w}=(w_x, w_y, w_z)\), with origin o

Methods

center_centroid() Center centroid on origin.
contains(point) Test region membership of point in Parallelepiped.
get_points() Return list of points from GeometricRegion.points and GeometricRegion.vectors
rotate(**kwargs) Rotate GeometricRegion points and vectors.
todict() Returns a dict of the Parallelepiped constructor parameters.
translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.

Attributes Summary

a Alias for Parallelepiped.u.length.
abc Alias for Parallelepiped.lengths.
b Alias for Parallelepiped.v.length.
c Alias for Parallelepiped.w.length.
centroid Parallelepiped centroid, \((c_x, c_y, c_z)\).
lengths tuple of side lengths
o 3D point coordinates \((o_x, o_y, o_z)\) of origin.
u 3D direction vector \(\mathbf{u}=(u_x, u_y, u_z)\), with origin o
v 3D direction vector \(\mathbf{v}=(v_x, v_y, v_z)\), with origin o
volume Parallelepiped volume, \(V\).
w 3D direction vector \(\mathbf{w}=(w_x, w_y, w_z)\), with origin o

Methods Summary

contains(point) Test region membership of point in Parallelepiped.
todict() Returns a dict of the Parallelepiped constructor parameters.

Attributes Documentation

a

Alias for Parallelepiped.u.length.

abc

Alias for Parallelepiped.lengths.

b

Alias for Parallelepiped.v.length.

c

Alias for Parallelepiped.w.length.

centroid

Parallelepiped centroid, \((c_x, c_y, c_z)\).

Computed as the 3D point \((c_x, c_y, c_z)\) with coordinates:

\[c_x = o_x + \frac{u_x + v_x + w_x}{2}\]\[c_y = o_y + \frac{u_y + v_y + w_y}{2}\]\[c_z = o_z + \frac{u_z + v_z + w_z}{2}\]

where \((o_x, o_y, o_z)\), \((u_x, u_y, u_z)\), \((v_x, v_y, v_z)\), and \((w_x, w_y, w_z)\) are the \((x, y, z)\) coordinates of the origin \(o\) and \((x, y, z)\) components of the direction vectors \(\mathbf{u}\), \(\mathbf{v}\), and \(\mathbf{w}\), respectively.

Returns:3D Point of centroid.
Return type:Point
lengths

tuple of side lengths

o

3D point coordinates \((o_x, o_y, o_z)\) of origin.

Returns:3D Point coordinates \((o_x, o_y, o_z)\) of origin.
Return type:Point
u

3D direction vector \(\mathbf{u}=(u_x, u_y, u_z)\), with origin o

v

3D direction vector \(\mathbf{v}=(v_x, v_y, v_z)\), with origin o

volume

Parallelepiped volume, \(V\).

Computed as:

\[V = |\mathbf{u}\cdot\mathbf{v}\times\mathbf{w}|\]
w

3D direction vector \(\mathbf{w}=(w_x, w_y, w_z)\), with origin o

Methods Documentation

contains(point)[source] [edit on github][source]

Test region membership of point in Parallelepiped.

Parameters:point (array_like) –
Returns:True if point is within Parallelepiped, False otherwise
Return type:bool

Notes

A point \((p_x, p_y, p_z)\) is within the bounded region of a parallelepiped with origin \((o_x, o_y, o_z)\) and direction vectors \(\mathbf{u}=(u_x, u_y, u_z)\), \(\mathbf{v}=(v_x, v_y, v_z)\), and \(\mathbf{w}=(w_x, w_y, w_z)\) if the following is true:

\[0\le\frac{ v_z (w_x (p_y - o_y) + w_y (o_x - p_x)) + w_z (v_x (o_y - p_y) + v_y (p_x - o_x)) + o_z (v_y w_x - v_x w_y) + p_z (v_x w_y - v_y w_x)}{ u_z (v_x w_y - v_y w_x) + u_y (v_z w_x - v_x w_z) + u_x (v_y w_z - v_z w_y)}\le 1 \land\]\[0\le\frac{ u_z (w_x (p_y - o_y) + w_y (o_x - p_x)) + w_z (u_x (o_y - p_y) + u_y (p_x - o_x)) + o_z (u_y w_x - u_x w_y) + p_z (u_x w_y - u_y w_x)}{ u_z (v_y w_x - v_x w_y) + u_y (v_x w_z - v_z w_x) + u_x (v_z w_y - v_y w_z)}\le 1 \land\]\[0\le\frac{ u_z (v_x (p_y - o_y) + v_y (o_x - p_x)) + v_z (u_x (o_y - p_y) + u_y (p_x - o_x)) + o_z (u_y v_x - u_x v_y) + p_z (u_x v_y - u_y v_x)}{ u_z (v_x w_y - v_y w_x) + u_y (v_z w_x - v_x w_z) + u_x (v_y w_z - v_z w_y)}\le 1\]
todict()[source] [edit on github][source]

Returns a dict of the Parallelepiped constructor parameters.