@trashpanda001/helpers
    Preparing search index...

    Function distance

    • Calculate the Euclidean distance between two points with cartesian coordinates.

      Parameters

      • x1: number

        the x coordinate of the first point

      • y1: number

        the y coordinate of the first point

      • x2: number

        the x coordinate of the second point

      • y2: number

        the y coordinate of the second point

      Returns number

      the distance between the two points

      import { distance } from "@trashpanda001/helpers/number"

      distance(1, 2, 3, 4)
      // 2.8284271247461903
      distance (0, 0, 3, 4)
      // 5