scaleAdjoint method

void scaleAdjoint (double scale)

Converts into Adjugate matrix and scales by scale

Implementation

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