transform4 method Null safety

void transform4(
  1. Float32List out,
  2. int outOffset,
  3. Float32List matrix,
  4. int matrixOffset,
  5. Float32List vector,
  6. int vectorOffset
)

Transform the 4D vector starting at vectorOffset by the 4x4 matrix starting at matrixOffset. Store result in out starting at outOffset.

Implementation

static void transform4(Float32List out, int outOffset, Float32List matrix,
    int matrixOffset, Float32List vector, int vectorOffset) {
  final x = vector[vectorOffset++];
  final y = vector[vectorOffset++];
  final z = vector[vectorOffset++];
  final w = vector[vectorOffset++];
  final m0 = matrix[matrixOffset];
  final m4 = matrix[4 + matrixOffset];
  final m8 = matrix[8 + matrixOffset];
  final m12 = matrix[12 + matrixOffset];
  out[outOffset++] = m0 * x + m4 * y + m8 * z + m12 * w;
  final m1 = matrix[1 + matrixOffset];
  final m5 = matrix[5 + matrixOffset];
  final m9 = matrix[9 + matrixOffset];
  final m13 = matrix[13 + matrixOffset];
  out[outOffset++] = m1 * x + m5 * y + m9 * z + m13 * w;
  final m2 = matrix[2 + matrixOffset];
  final m6 = matrix[6 + matrixOffset];
  final m10 = matrix[10 + matrixOffset];
  final m14 = matrix[14 + matrixOffset];
  out[outOffset++] = m2 * x + m6 * y + m10 * z + m14 * w;
  final m3 = matrix[3 + matrixOffset];
  final m7 = matrix[7 + matrixOffset];
  final m11 = matrix[11 + matrixOffset];
  final m15 = matrix[15 + matrixOffset];
  out[outOffset++] = m3 * x + m7 * y + m11 * z + m15 * w;
}