sl.cart.dist: Cartesian Distance

View source: R/sl.cart.dist.R

sl.cart.distR Documentation

Cartesian Distance

Description

Compute Cartesian distance between two points in any dimension.

Usage

sl.cart.dist(a, b = NULL, norm = 2)

Arguments

a

a scalar or numerical vector of any length giving the location of one point

b

a scalar or numerical vector of the same length as a giving the location of the second point. If not specified, the distance of a from the origin is computed.

norm

With the default value norm=2 the Euclidean distance is computed, but any other norm can be specified.

Value

Single scalar providing the distance.

Author(s)

Helge Goessling

See Also

sl.gc.dist

Examples

## Example in 3 dimensional space:
sl.cart.dist(a=c(0,0,0),b=c(1,1,1))
## Should return:
## [1] 1.732051

helgegoessling/spheRlab documentation built on March 8, 2024, 7:54 p.m.