<commit_before>export interface Point {
    x: number;
    y: number;
}

export type Segment = [Point, Point];

export function intersection(s1: Segment, s2: Segment): Point {
    // Express segments as y = ax + b.

    const a1 = (s1[1].y - s1[0].y) / (s1[1].x - s1[0].x);
    const a2 = (s2[1].y - s2[0].y) / (s2[1].x - s2[0].x);

    if (a1 === a2 || !isFinite(a1) && !isFinite(a2)) {
        // The segments are parallel.
        return;
    }

    let intX: number;
    let intY: number;

    if (!isFinite(a1)) {
        // s1 is vertical.
        intX = s1[0].x;
        const b2 = s2[0].y - a2 * s2[0].x;<commit_msg>[intersection_detection/typescript] Fix compilation with tsc 2.2.2<commit_after>export interface Point {
    x: number;
    y: number;
}

export type Segment = [Point, Point];

export function intersection(s1: Segment, s2: Segment): Point {
    // Express segments as y = ax + b.

    const a1 = (s1[1].y - s1[0].y) / (s1[1].x - s1[0].x);
    const a2 = (s2[1].y - s2[0].y) / (s2[1].x - s2[0].x);

    if (a1 === a2 || !isFinite(a1) && !isFinite(a2)) {
        // The segments are parallel.
        return undefined;
    }

    let intX: number;
    let intY: number;

    if (!isFinite(a1)) {
        // s1 is vertical.
        intX = s1[0].x;
        const b2 = s2[0].y - a2 * s2[0].x;
{'fraction_non_alphanumeric': 0.18230358504958047, 'fraction_numerical': 0.05415713196033562, 'mean_word_length': 2.138755980861244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '128577', 'n_tokens_mistral': 546, 'n_tokens_neox': 533, 'n_words': 135}