Vector-to-Vector Distance and Pythagorean Computation

Calculate distance and hypotenuse of vectors.

Topics

Vector-to-Vector Hypotenuse Computation

static func hypot<U, V>(U, V) -> [Double]

Returns the double-precision hypotenuse of right-angled triangles with sides that are the lengths of corresponding elements of vectors x and y.

static func hypot<U, V>(U, V) -> [Float]

Returns the single-precision hypotenuse of right-angled triangles with sides that are the lengths of corresponding elements of vectors x and y.

static func hypot<T, U, V>(T, U, result: inout V)

Calculates the double-precision hypotenuse of right-angled triangles with sides that are the lengths of corresponding elements of vectors x and y.

static func hypot<T, U, V>(T, U, result: inout V)

Calculates the single-precision hypotenuse of right-angled triangles with sides that are the lengths of corresponding elements of vectors x and y.

static func hypot<R, S, T, U>(x0: R, x1: S, y0: T, y1: U) -> [Double]

Returns the double-precision hypotenuse of right-angled triangles with sides that are the differences of corresponding elements of vectors x0, x1, and y0, y1.

static func hypot<R, S, T, U>(x0: R, x1: S, y0: T, y1: U) -> [Float]

Returns the single-precision hypotenuse of right-angled triangles with sides that are the differences of corresponding elements of vectors x0, x1, and y0, y1.

static func hypot<R, S, T, U, V>(x0: R, x1: S, y0: T, y1: U, result: inout V)

Calculates the double-precision hypotenuse of right-angled triangles with sides that are the differences of corresponding elements of vectors x0, x1, and y0, y1.

static func hypot<R, S, T, U, V>(x0: R, x1: S, y0: T, y1: U, result: inout V)

Calculates the single-precision hypotenuse of right-angled triangles with sides that are the differences of corresponding elements of vectors x0, x1, and y0, y1.

Vector-to-Vector Distance Computation

static func distanceSquared<U, V>(U, V) -> Double

Returns the double-precision distance squared between two points in n-dimensional space.

static func distanceSquared<U, V>(U, V) -> Float

Returns the single-precision distance squared between two points in n-dimensional space.

func vDSP_distancesq(UnsafePointer<Float>, vDSP_Stride, UnsafePointer<Float>, vDSP_Stride, UnsafeMutablePointer<Float>, vDSP_Length)

Calculates the distance squared between two single-precision points in n-dimensional space, using the specified strides.

func vDSP_distancesqD(UnsafePointer<Double>, vDSP_Stride, UnsafePointer<Double>, vDSP_Stride, UnsafeMutablePointer<Double>, vDSP_Length)

Calculates the distance squared between two double-precision points in n-dimensional space, using the specified strides.

See Also

Vector Geometry Functions

Dot Product Calculation

Calculate the scalar product of two vectors.