Global Function

mag()

Declaration

func mag(x: Double, y: Double) -> Double

Parameters

x First vector component.
y Second vector component.

Returns

Double - magnitude value.

Description

Calculates the magnitude of a (2d) vector. This vector is relative to the origin (0,0).

Examples

let x1 = 150.0
let y1 = 180.0
let m = mag(x: x1, y: y1)
// The value of m is 234.3074

Related