diff --git a/adze/split.py b/adze/split.py index 07a1e36..201171c 100644 --- a/adze/split.py +++ b/adze/split.py @@ -1,4 +1,5 @@ -import numpy +from typing import Tuple, Union +import numpy # type: ignore from . import poly_t, plane_t from .util import build_empty, _get_map @@ -9,7 +10,7 @@ def clip(poly: poly_t, plane: plane_t) -> poly_t: Clip a polyhedron with a plane, keeping only the part which is on the same side as the plane's normal vector. - This function is equivalent to calling split(poly, plane, same_only=True). + This function is equivalent to calling _split(poly, plane, same_only=True). Args: poly: Polyhedron to clip, in chiral Schlegel representation. @@ -18,11 +19,26 @@ def clip(poly: poly_t, plane: plane_t) -> poly_t: Returns: Clipped polyhedron. ''' - left_poly = split(poly, plane, same_only=True) + left_poly = _split(poly, plane, same_only=True) return left_poly -def split(poly: poly_t, plane: plane_t, same_only: bool = False) -> Tuple[poly_t, poly_t]: +def split(poly: poly_t, plane: plane_t) -> Tuple[poly_t, poly_t]: + ''' + Clip a polyhedron with a plane, keeping both parts. + + This function is equivalent to calling _split(poly, plane, same_only=False). + + Args: + poly: Polyhedron to clip, in chiral Schlegel representation. + plane: Plane to clip against. + Returns: + same_side_poly, other_side_poly + The first polyhedron is on from the same side as the plane's normal vector. + ''' + + +def _split(poly: poly_t, plane: plane_t, same_only: bool = False): ''' Clip a polyhedron with a plane.