getAngle method

double getAngle(
  1. EVector2D vct
)

Implementation

double getAngle(EVector2D vct) {
  double xMult = x * vct.x;
  double yMult = y * vct.y;
  double product = xMult + yMult;
  double angle = math.acos(product / (getLength() * vct.getLength()));
  //if vector.length is 0 => handle NaN
  if (angle.isNaN) {
    return 0;
  }
  return angle;
}