Global Function
Declaration
func dist( x1: Double, y1: Double, x2: Double, y2: Double ) -> Double
Parameters
| x1 | first point x component. |
| y1 | first point y component. |
| x2 | second point x component. |
| y2 | second point y component. |
Returns
Double - distance value.
Description
Compute the distance from point (x1,y1) to point (x2,y2).
Examples
// Compute distance from 100,100 to 400,300
let distance = dist(x1: 100.0, y1: 100.0, x2: 400.0, y2: 300.0)
// Compute distance from the current mouse location to center of the view.
let distance = dist(x1: tin.mouseX, y1: tin.mouseY, x2: tin.midX, y2: tin.midY)Related