solve2 static method

void solve2(
  1. Matrix4 A,
  2. Vector2 x,
  3. Vector2 b
)

Solve A * x = b.

Implementation

static void solve2(Matrix4 A, Vector2 x, Vector2 b) {
  final a11 = A.entry(0, 0);
  final a12 = A.entry(0, 1);
  final a21 = A.entry(1, 0);
  final a22 = A.entry(1, 1);
  final bx = b.x - A._m4storage[8];
  final by = b.y - A._m4storage[9];
  var det = a11 * a22 - a12 * a21;

  if (det != 0.0) {
    det = 1.0 / det;
  }

  x
    ..x = det * (a22 * bx - a12 * by)
    ..y = det * (a11 * by - a21 * bx);
}