Rename split() to _split() and make new split() function with known return type
This commit is contained in:
parent
1a034002fb
commit
b791d3c854
1 changed files with 20 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import numpy
|
from typing import Tuple, Union
|
||||||
|
import numpy # type: ignore
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
from .util import build_empty, _get_map
|
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
|
Clip a polyhedron with a plane, keeping only the part which is on
|
||||||
the same side as the plane's normal vector.
|
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:
|
Args:
|
||||||
poly: Polyhedron to clip, in chiral Schlegel representation.
|
poly: Polyhedron to clip, in chiral Schlegel representation.
|
||||||
|
|
@ -18,11 +19,26 @@ def clip(poly: poly_t, plane: plane_t) -> poly_t:
|
||||||
Returns:
|
Returns:
|
||||||
Clipped polyhedron.
|
Clipped polyhedron.
|
||||||
'''
|
'''
|
||||||
left_poly = split(poly, plane, same_only=True)
|
left_poly = _split(poly, plane, same_only=True)
|
||||||
return left_poly
|
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.
|
Clip a polyhedron with a plane.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue