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.Geometric3DRegionGeometric3DRegionfor 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: Notes
Parallelepipedrepresents 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
Parallelepipedwith no parameters is equivalent toParallelepiped(o=[0, 0, 0], u=[1, 0, 0], v=[1, 1, 0], w=[0, 1, 1]).Attributes
aAlias for Parallelepiped.u.length.abcAlias for Parallelepiped.lengths.bAlias for Parallelepiped.v.length.bounding_boxBounding Cuboid.cAlias for Parallelepiped.w.length.centerAlias for centroid.centroidParallelepiped centroid, \((c_x, c_y, c_z)\). fmtstrFormat string. lengthstupleof side lengthsmeasureAlias for volume, which is the measure of a 3D geometric region.ndimReturn the dimensions. o3D point coordinates \((o_x, o_y, o_z)\) of origin. pmaxPointat maximum extent.pminPointat minimum extent.u3D direction vector \(\mathbf{u}=(u_x, u_y, u_z)\), with origin ov3D direction vector \(\mathbf{v}=(v_x, v_y, v_z)\), with origin ovolumeParallelepiped volume, \(V\). w3D direction vector \(\mathbf{w}=(w_x, w_y, w_z)\), with origin oMethods
center_centroid()Center centroidon origin.contains(point)Test region membership of pointinParallelepiped.get_points()Return list of points from GeometricRegion.pointsandGeometricRegion.vectorsrotate(**kwargs)Rotate GeometricRegionpointsandvectors.todict()Returns a dictof theParallelepipedconstructor parameters.translate(t[, fix_anchor_points])Translate GeometricRegionpointsandvectorsbyVectort.Attributes Summary
aAlias for Parallelepiped.u.length.abcAlias for Parallelepiped.lengths.bAlias for Parallelepiped.v.length.cAlias for Parallelepiped.w.length.centroidParallelepiped centroid, \((c_x, c_y, c_z)\). lengthstupleof side lengthso3D point coordinates \((o_x, o_y, o_z)\) of origin. u3D direction vector \(\mathbf{u}=(u_x, u_y, u_z)\), with origin ov3D direction vector \(\mathbf{v}=(v_x, v_y, v_z)\), with origin ovolumeParallelepiped volume, \(V\). w3D direction vector \(\mathbf{w}=(w_x, w_y, w_z)\), with origin oMethods Summary
contains(point)Test region membership of pointinParallelepiped.todict()Returns a dictof theParallelepipedconstructor 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 Pointof centroid.Return type: Point
-
o¶ 3D point coordinates \((o_x, o_y, o_z)\) of origin.
Returns: 3D Pointcoordinates \((o_x, o_y, o_z)\) of origin.Return type: Point
-
volume¶ Parallelepiped volume, \(V\).
Computed as:
\[V = |\mathbf{u}\cdot\mathbf{v}\times\mathbf{w}|\]
Methods Documentation
-
contains(point)[source] [edit on github][source]¶ Test region membership of
pointinParallelepiped.Parameters: point (array_like) – Returns: Trueifpointis withinParallelepiped,FalseotherwiseReturn type: boolNotes
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
dictof theParallelepipedconstructor parameters.
-