magnitude property

double get magnitude

Get the straight line (Euclidean) distance between the origin (0, 0) and this point.

Example:

var magnitude = const Point(0, 0).magnitude; // 0.0
magnitude = const Point(10, 0).magnitude;  // 10.0
magnitude = const Point(0, -10).magnitude; // 10.0
magnitude = const Point(10, 10).magnitude;  // 14.142135623730951

Implementation

double get magnitude => sqrt(x * x + y * y);