rotate method

Vector2D rotate(
  1. double angle
)

Implementation

Vector2D rotate(double angle) {
  final cosres = math.cos(angle);
  final sinres = math.sin(angle);
  return .vec2(
    x*cosres - y*sinres,
    x*sinres + y*cosres,
  );
}