コード例 #1
0
ファイル: sphere.py プロジェクト: zhenming-xu/nanocut
 def __init__(self, geometry, period, **kwargs):
     """Creates Sphere instance.
     
     Keyword args:
         shift_vector: Origin of the sphere.
         radius: Radius of the sphere.
     """
     Body.__init__(self, geometry, period, **kwargs)
     self.radius = kwargs.get("radius")
コード例 #2
0
ファイル: cylinder.py プロジェクト: zhenming-xu/nanocut
 def __init__(self, geometry, period, **kwargs):
     """Creates a Cylinder instance.
     
     Keyword args:
         point1: Middle point of the base circle.
         point2: Middle point of the top circle.
         radius1: Radius of the base circle.
         radius2: Radius of the top circle. 
     """
     Body.__init__(self, geometry, period, **kwargs)
     self._point1 = geometry.coord_transform(
         kwargs.get("point1"),
         kwargs.get("point1_coordsys", "lattice"))
     self._point2 = geometry.coord_transform(
         kwargs.get("point2"),
         kwargs.get("point2_coordsys", "lattice"))
     self._radius1 = kwargs.get("radius1")
     self._radius2 = kwargs.get("radius2")
     self._dir_vector = self._point2 - self._point1
     self._norm = np.linalg.norm(self._dir_vector)