point2.distance

The Euclidean distance between two plane points.

Value helperSince 0.3.0

Usage

TypeScript
Point2.distance(a: Point2, b: Point2): number

Parameters

  • aPoint2

    First point. Required. In model.

  • bPoint2

    Second point. Required. In model.

Returns

A non-negative distance in model units; NaN when a coordinate is NaN or two infinities cancel. Infinity when a coordinate is infinite and the difference is too.

Example

TypeScript
Point2.distance(Point2.of(0, 0), Point2.of(3, 4)) // → 5

See also