def check_lines(first, second):
    """Checks if two curves are lines and tries to intersect them.

    .. note::

       This is a helper for :func:`._all_intersections`.

    If they are not lines / not linearized, immediately returns :data:`False`
    with no "return value".

    If they are lines, attempts to intersect them (even if they are parallel
    and share a coincident segment).

    Args:
        first (Union[SubdividedCurve, Linearization]): First curve being
            intersected.
        second (Union[SubdividedCurve, Linearization]): Second curve being
            intersected.

    Returns:
        Tuple[bool, Optional[Tuple[numpy.ndarray, bool]]]: A pair of

        * Flag indicating if both candidates in the pair are lines.
        * Optional "result" populated only if both candidates are lines.
          When this result is populated, it will be a pair of

          * array of parameters of intersection
          * flag indicating if the two candidates share a coincident segment
    """
    # NOTE: In the below we replace ``isinstance(a, B)`` with
    #       ``a.__class__ is B``, which is a 3-3.5x speedup.
    if not (
        first.__class__ is Linearization
        and second.__class__ is Linearization
        and first.error == 0.0
        and second.error == 0.0
    ):
        return False, None

    s, t, success = segment_intersection(
        first.start_node, first.end_node, second.start_node, second.end_node
    )
    if success:
        if _helpers.in_interval(s, 0.0, 1.0) and _helpers.in_interval(
            t, 0.0, 1.0
        ):
            intersections = np.asfortranarray([[s], [t]])
            result = intersections, False
        else:
            result = np.empty((2, 0), order="F"), False
    else:
        disjoint, params = parallel_lines_parameters(
            first.start_node,
            first.end_node,
            second.start_node,
            second.end_node,
        )
        if disjoint:
            result = np.empty((2, 0), order="F"), False
        else:
            result = params, True
    return True, result
def check_lines ( first , second ) : if not ( first . __class__ is Linearization and second . __class__ is Linearization and first . error == 0.0 and second . error == 0.0 ) : return False , None s , t , success = segment_intersection ( first . start_node , first . end_node , second . start_node , second . end_node ) if success : if _helpers . in_interval ( s , 0.0 , 1.0 ) and _helpers . in_interval ( t , 0.0 , 1.0 ) : intersections = np . asfortranarray ( [ [ s ] , [ t ] ] ) result = intersections , False else : result = np . empty ( ( 2 , 0 ) , order = "F" ) , False else : disjoint , params = parallel_lines_parameters ( first . start_node , first . end_node , second . start_node , second . end_node , ) if disjoint : result = np . empty ( ( 2 , 0 ) , order = "F" ) , False else : result = params , True return True , result
Checks if two curves are lines and tries to intersect them.

    .. note::

       This is a helper for :func:`._all_intersections`.

    If they are not lines / not linearized, immediately returns :data:`False`
    with no "return value".

    If they are lines, attempts to intersect them (even if they are parallel
    and share a coincident segment).

    Args:
        first (Union[SubdividedCurve, Linearization]): First curve being
            intersected.
        second (Union[SubdividedCurve, Linearization]): Second curve being
            intersected.

    Returns:
        Tuple[bool, Optional[Tuple[numpy.ndarray, bool]]]: A pair of

        * Flag indicating if both candidates in the pair are lines.
        * Optional "result" populated only if both candidates are lines.
          When this result is populated, it will be a pair of

          * array of parameters of intersection
          * flag indicating if the two candidates share a coincident segment