angleTo method

double angleTo (Vector2 other)

Returns the angle between this vector and other in radians.

Implementation

double angleTo(Vector2 other) {
  final Float64List otherStorage = other._v2storage;
  if (_v2storage[0] == otherStorage[0] && _v2storage[1] == otherStorage[1]) {
    return 0.0;
  }

  final double d = dot(other) / (length * other.length);

  return math.acos(d.clamp(-1.0, 1.0));
}