• Parameters

    • a: VecLine2

      line object with "vector" and "origin"

    • b: VecLine2

      line object with "vector" and "origin"

    • Optional aDomain: Function = includeL

      the domain of the first line

    • Optional bDomain: Function = includeL

      the domain of the second line

    • Optional epsilon: number = EPSILON

      optional epsilon

    Returns {
        a: number;
        b: number;
        point: [number, number];
    }

    object with properties:

    • point: one 2D point or undefined
    • a: the intersection parameter along the first line
    • b: the intersection parameter along the second line
    • a: number
    • b: number
    • point: [number, number]

    Description

    Find the intersection of two lines. Lines can be lines/rays/segments, and can be inclusive or exclusive in terms of their endpoints and the epsilon value.

    Example

    // intersect two lines
    const { a, b, point } = intersectLine(line1, line2);

    Example

    // intersect a line and a segment
    const { a, b, point } = intersectLine(line, segment, ear.math.includeL, ear.math.includeS);