average property

(int, int, int) get average

Implementation

(int x, int y, int z) get average {
  if (_buffer.isEmpty) return (0, 0, 0);

  int sumX = 0, sumY = 0, sumZ = 0;
  for (var value in _buffer) {
    sumX += value.$1;
    sumY += value.$2;
    sumZ += value.$3;
  }
  return (
    (sumX ~/ _buffer.length),
    (sumY ~/ _buffer.length),
    (sumZ ~/ _buffer.length)
  );
}