reflect function

List<num> reflect(
  1. num ix,
  2. num iy,
  3. num nx,
  4. num ny
)

Implementation

List<num> reflect(num ix, num iy, num nx, num ny) {
  // I - 2.0 * dot(N, I) * N.
  var d = dot(nx, ny, ix, iy);
  return [
    ix - 2 * d * nx,
    iy - 2 * d * ny,
  ];
}