scaleAdjoint method Null safety

void scaleAdjoint(
  1. double scale
)

Converts into Adjugate matrix and scales by scale

Implementation

void scaleAdjoint(double scale) {
  // Adapted from code by Richard Carling.
  final a1 = _m4storage[0];
  final b1 = _m4storage[4];
  final c1 = _m4storage[8];
  final d1 = _m4storage[12];
  final a2 = _m4storage[1];
  final b2 = _m4storage[5];
  final c2 = _m4storage[9];
  final d2 = _m4storage[13];
  final a3 = _m4storage[2];
  final b3 = _m4storage[6];
  final c3 = _m4storage[10];
  final d3 = _m4storage[14];
  final a4 = _m4storage[3];
  final b4 = _m4storage[7];
  final c4 = _m4storage[11];
  final d4 = _m4storage[15];
  _m4storage[0] = (b2 * (c3 * d4 - c4 * d3) -
          c2 * (b3 * d4 - b4 * d3) +
          d2 * (b3 * c4 - b4 * c3)) *
      scale;
  _m4storage[1] = -(a2 * (c3 * d4 - c4 * d3) -
          c2 * (a3 * d4 - a4 * d3) +
          d2 * (a3 * c4 - a4 * c3)) *
      scale;
  _m4storage[2] = (a2 * (b3 * d4 - b4 * d3) -
          b2 * (a3 * d4 - a4 * d3) +
          d2 * (a3 * b4 - a4 * b3)) *
      scale;
  _m4storage[3] = -(a2 * (b3 * c4 - b4 * c3) -
          b2 * (a3 * c4 - a4 * c3) +
          c2 * (a3 * b4 - a4 * b3)) *
      scale;
  _m4storage[4] = -(b1 * (c3 * d4 - c4 * d3) -
          c1 * (b3 * d4 - b4 * d3) +
          d1 * (b3 * c4 - b4 * c3)) *
      scale;
  _m4storage[5] = (a1 * (c3 * d4 - c4 * d3) -
          c1 * (a3 * d4 - a4 * d3) +
          d1 * (a3 * c4 - a4 * c3)) *
      scale;
  _m4storage[6] = -(a1 * (b3 * d4 - b4 * d3) -
          b1 * (a3 * d4 - a4 * d3) +
          d1 * (a3 * b4 - a4 * b3)) *
      scale;
  _m4storage[7] = (a1 * (b3 * c4 - b4 * c3) -
          b1 * (a3 * c4 - a4 * c3) +
          c1 * (a3 * b4 - a4 * b3)) *
      scale;
  _m4storage[8] = (b1 * (c2 * d4 - c4 * d2) -
          c1 * (b2 * d4 - b4 * d2) +
          d1 * (b2 * c4 - b4 * c2)) *
      scale;
  _m4storage[9] = -(a1 * (c2 * d4 - c4 * d2) -
          c1 * (a2 * d4 - a4 * d2) +
          d1 * (a2 * c4 - a4 * c2)) *
      scale;
  _m4storage[10] = (a1 * (b2 * d4 - b4 * d2) -
          b1 * (a2 * d4 - a4 * d2) +
          d1 * (a2 * b4 - a4 * b2)) *
      scale;
  _m4storage[11] = -(a1 * (b2 * c4 - b4 * c2) -
          b1 * (a2 * c4 - a4 * c2) +
          c1 * (a2 * b4 - a4 * b2)) *
      scale;
  _m4storage[12] = -(b1 * (c2 * d3 - c3 * d2) -
          c1 * (b2 * d3 - b3 * d2) +
          d1 * (b2 * c3 - b3 * c2)) *
      scale;
  _m4storage[13] = (a1 * (c2 * d3 - c3 * d2) -
          c1 * (a2 * d3 - a3 * d2) +
          d1 * (a2 * c3 - a3 * c2)) *
      scale;
  _m4storage[14] = -(a1 * (b2 * d3 - b3 * d2) -
          b1 * (a2 * d3 - a3 * d2) +
          d1 * (a2 * b3 - a3 * b2)) *
      scale;
  _m4storage[15] = (a1 * (b2 * c3 - b3 * c2) -
          b1 * (a2 * c3 - a3 * c2) +
          c1 * (a2 * b3 - a3 * b2)) *
      scale;
}