def combine_intersections(
    intersections, nodes1, degree1, nodes2, degree2, all_types
):
    r"""Combine curve-curve intersections into curved polygon(s).

    .. note::

       This is a helper used only by :meth:`.Surface.intersect`.

    Does so assuming each intersection lies on an edge of one of
    two :class:`.Surface`-s.

    .. note ::

       This assumes that each ``intersection`` has been classified via
       :func:`classify_intersection` and only the intersections classified
       as ``FIRST`` and ``SECOND`` were kept.

    Args:
        intersections (List[.Intersection]): Intersections from each of the
            9 edge-edge pairs from a surface-surface pairing.
        nodes1 (numpy.ndarray): The nodes defining the first surface in
            the intersection (assumed in :math:\mathbf{R}^2`).
        degree1 (int): The degree of the surface given by ``nodes1``.
        nodes2 (numpy.ndarray): The nodes defining the second surface in
            the intersection (assumed in :math:\mathbf{R}^2`).
        degree2 (int): The degree of the surface given by ``nodes2``.
        all_types (Set[.IntersectionClassification]): The set of all
            intersection classifications encountered among the intersections
            for the given surface-surface pair.

    Returns:
        Tuple[Optional[list], Optional[bool]]: Pair (2-tuple) of

        * List of "edge info" lists. Each list represents a curved polygon
          and contains 3-tuples of edge index, start and end (see the
          output of :func:`ends_to_curve`).
        * "Contained" boolean. If not :data:`None`, indicates
          that one of the surfaces is contained in the other.
    """
    if intersections:
        return basic_interior_combine(intersections)

    elif all_types:
        return tangent_only_intersections(all_types)

    else:
        return no_intersections(nodes1, degree1, nodes2, degree2)