Example #1
0
def intersection_segment_segment_xy(ab, cd, tol=1e-6):
    """Compute the intersection of two lines segments, assuming they lie in the XY plane.

    Parameters
    ----------
    ab : tuple
        XY(Z) coordinates of two points defining a line segment.
    cd : tuple
        XY(Z) coordinates of two points defining another line segment.
    tol : float, optional
        A tolerance for membership verification.
        Default is ``0.0``.

    Returns
    -------
    None
        If there is no intersection point.
    list
        XYZ coordinates of intersection point if one exists.

    """
    intx_pt = intersection_line_line_xy(ab, cd)

    if not intx_pt:
        return None

    if not is_point_on_segment_xy(intx_pt, ab, tol=tol):
        return None

    if not is_point_on_segment_xy(intx_pt, cd, tol=tol):
        return None

    return intx_pt
Example #2
0
def intersection_segment_segment_xy(ab, cd, tol=0.):
    """Compute the intersection of two lines segments, assuming they lie in the XY plane.

    Parameters
    ----------
    ab : tuple
        XY(Z) coordinates of two points defining a line segment.
    cd : tuple
        XY(Z) coordinates of two points defining another line segment.

    Returns
    -------
    None
        If there is no intersection point.
    list
        XYZ coordinates of intersection point if one exists.

    """
    intx_pt = intersection_line_line_xy(ab, cd)

    if not intx_pt:
        return None

    if not is_point_on_segment_xy(intx_pt, ab, tol):
        return None

    if not is_point_on_segment_xy(intx_pt, cd, tol):
        return None

    return intx_pt
Example #3
0
def intersection_segment_segment_xy(ab, cd, tol=0.):
    """"""
    intx_pt = intersection_line_line_xy(ab, cd)

    if not intx_pt:
        return None

    if not is_point_on_segment_xy(intx_pt, ab, tol):
        return None

    if not is_point_on_segment_xy(intx_pt, cd, tol):
        return None

    return intx_pt
Example #4
0
def intersection_line_segment_xy(line, segment, tol=1e-6):
    """"""
    x = intersection_line_line_xy(line, segment, tol=tol)

    if not x:
        return None

    if is_point_on_segment_xy(x, segment, tol=tol):
        return x