reflectBetween static method

Vec2 reflectBetween(
  1. Vec2 direction,
  2. Vec2 normal
)

Implementation

static Vec2 reflectBetween(Vec2 direction, Vec2 normal) {
  final d = 2 * direction.dot(normal);
  return Vec2(
    direction.x - d * normal.x,
    direction.y - d * normal.y,
  );
}