Skip to contents

Computes the Euclidean distance between two 2D points.

Usage

euclideanDistance(p1, p2)

Arguments

p1

A numeric vector of length 2 representing the first point's coordinates (x, y).

p2

A numeric vector of length 2 representing the second point's coordinates (x, y).

Value

A numeric value representing the distance between the two points.

Examples

euclideanDistance(c(0, 0), c(3, 4))
#> [1] 5