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 (ox,oy,oz) and direction vectors u=(ux,uy,uz), v=(vx,vy,vz), and w=(wx,wy,wz).

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 {o+λ1u+λ2v+λ3wR3|0λi1}, where u, v, and 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, (cx,cy,cz).
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 (ox,oy,oz) of origin.
pmax Point at maximum extent.
pmin Point at minimum extent.
u 3D direction vector u=(ux,uy,uz), with origin o
v 3D direction vector v=(vx,vy,vz), with origin o
volume Parallelepiped volume, V.
w 3D direction vector w=(wx,wy,wz), 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, (cx,cy,cz).
lengths tuple of side lengths
o 3D point coordinates (ox,oy,oz) of origin.
u 3D direction vector u=(ux,uy,uz), with origin o
v 3D direction vector v=(vx,vy,vz), with origin o
volume Parallelepiped volume, V.
w 3D direction vector w=(wx,wy,wz), 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, (cx,cy,cz).

Computed as the 3D point (cx,cy,cz) with coordinates:

cx=ox+ux+vx+wx2cy=oy+uy+vy+wy2cz=oz+uz+vz+wz2

where (ox,oy,oz), (ux,uy,uz), (vx,vy,vz), and (wx,wy,wz) are the (x,y,z) coordinates of the origin o and (x,y,z) components of the direction vectors u, v, and w, respectively.

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

tuple of side lengths

o

3D point coordinates (ox,oy,oz) of origin.

Returns:3D Point coordinates (ox,oy,oz) of origin.
Return type:Point
u

3D direction vector u=(ux,uy,uz), with origin o

v

3D direction vector v=(vx,vy,vz), with origin o

volume

Parallelepiped volume, V.

Computed as:

V=|uv×w|
w

3D direction vector w=(wx,wy,wz), 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 (px,py,pz) is within the bounded region of a parallelepiped with origin (ox,oy,oz) and direction vectors u=(ux,uy,uz), v=(vx,vy,vz), and w=(wx,wy,wz) if the following is true:

0vz(wx(pyoy)+wy(oxpx))+wz(vx(oypy)+vy(pxox))+oz(vywxvxwy)+pz(vxwyvywx)uz(vxwyvywx)+uy(vzwxvxwz)+ux(vywzvzwy)10uz(wx(pyoy)+wy(oxpx))+wz(ux(oypy)+uy(pxox))+oz(uywxuxwy)+pz(uxwyuywx)uz(vywxvxwy)+uy(vxwzvzwx)+ux(vzwyvywz)10uz(vx(pyoy)+vy(oxpx))+vz(ux(oypy)+uy(pxox))+oz(uyvxuxvy)+pz(uxvyuyvx)uz(vxwyvywx)+uy(vzwxvxwz)+ux(vywzvzwy)1
todict()[source] [edit on github][source]

Returns a dict of the Parallelepiped constructor parameters.