getLength method

double getLength()

Implementation

double getLength() {
  double length = math.sqrt(math.pow(x, 2) + math.pow(y, 2));
  return length.isNaN ? 0 : length;
}