• Calculates the Euclidean distance between two points in 2D space.

    This function computes the straight-line distance (also known as the Euclidean distance) between two points represented as [x, y] coordinates.

    Parameters

    • v: T_Point

      The first point, represented as [x, y].

    • w: T_Point

      The second point, represented as [x, y].

    Returns number

    The Euclidean distance between the two points.

    // Define two points
    const point1: T_Point = [0, 0];
    const point2: T_Point = [3, 4];

    // Calculate the distance
    const distance = pointPointDistance(point1, point2);
    console.log(distance); // 5

    // Points at the same location
    const distance2 = pointPointDistance([1, 1], [1, 1]);
    console.log(distance2); // 0