# Path: geomeppy/utilities.py
# def almostequal(first, second, places=7):
#     # type: (Any, Any, int) -> bool
#     """Tests a range of types for near equality."""
#     try:
#         # try converting to float first
#         first = float(first)
#         second = float(second)
#         # test floats for near-equality
#         if round(abs(second - first), places) != 0:
#             return False
#         else:
#             return True
#     except ValueError:
#         # handle non-float types
#         return str(first) == str(second)
#     except TypeError:
#         # handle iterables
#         return all([almostequal(a, b, places) for a, b in zip(first, second)])


from typing import List  # noqa
    from .polygons import Polygon  # noqa
from ..utilities import almostequal
import pyclipper as pc
        :param poly: The clip polygon.
        :returns: A Pyclipper object.

        """
        if not self.is_coplanar(poly):
            return False
        poly1 = self.project_to_2D()
        poly2 = poly.project_to_2D()

        s1 = pc.scale_to_clipper(poly1.vertices_list)
        s2 = pc.scale_to_clipper(poly2.vertices_list)
        clipper = pc.Pyclipper()
        clipper.AddPath(s1, poly_type=pc.PT_SUBJECT, closed=True)
        clipper.AddPath(s2, poly_type=pc.PT_CLIP, closed=True)

        return clipper

    def _process(self, results):
        """Process and return the results of a clipping operation.

        :param results: A list of lists of coordinates .
        :returns: A list of Polygon3D results of the clipping operation.

        """
        if not results:
            return []
        results = [pc.scale_from_clipper(r) for r in results]
        polys = [self.as_2d(v).project_to_3D(self) for v in results]
        processed = []
        for poly in polys:

# Path: geomeppy/utilities.py
# def almostequal(first, second, places=7):
#     # type: (Any, Any, int) -> bool
#     """Tests a range of types for near equality."""
#     try:
#         # try converting to float first
#         first = float(first)
#         second = float(second)
#         # test floats for near-equality
#         if round(abs(second - first), places) != 0:
#             return False
#         else:
#             return True
#     except ValueError:
#         # handle non-float types
#         return str(first) == str(second)
#     except TypeError:
#         # handle iterables
#         return all([almostequal(a, b, places) for a, b in zip(first, second)])


# Path: geomeppy/geom/clippers.py
from typing import List  # noqa
    from .polygons import Polygon  # noqa
from ..utilities import almostequal
import pyclipper as pc

        :param poly: The clip polygon.
        :returns: A Pyclipper object.

        """
        if not self.is_coplanar(poly):
            return False
        poly1 = self.project_to_2D()
        poly2 = poly.project_to_2D()

        s1 = pc.scale_to_clipper(poly1.vertices_list)
        s2 = pc.scale_to_clipper(poly2.vertices_list)
        clipper = pc.Pyclipper()
        clipper.AddPath(s1, poly_type=pc.PT_SUBJECT, closed=True)
        clipper.AddPath(s2, poly_type=pc.PT_CLIP, closed=True)

        return clipper

    def _process(self, results):
        """Process and return the results of a clipping operation.

        :param results: A list of lists of coordinates .
        :returns: A list of Polygon3D results of the clipping operation.

        """
        if not results:
            return []
        results = [pc.scale_from_clipper(r) for r in results]
        polys = [self.as_2d(v).project_to_3D(self) for v in results]
        processed = []
        for poly in polys:

            if almostequal(self.normal_vector, poly.normal_vector):