volume static method

int volume(
  1. Box cube,
  2. List<int> moment
)

Implementation

static int volume(Box cube, List<int> moment) {
  return (moment[getIndex(cube.r1, cube.g1, cube.b1)] -
      moment[getIndex(cube.r1, cube.g1, cube.b0)] -
      moment[getIndex(cube.r1, cube.g0, cube.b1)] +
      moment[getIndex(cube.r1, cube.g0, cube.b0)] -
      moment[getIndex(cube.r0, cube.g1, cube.b1)] +
      moment[getIndex(cube.r0, cube.g1, cube.b0)] +
      moment[getIndex(cube.r0, cube.g0, cube.b1)] -
      moment[getIndex(cube.r0, cube.g0, cube.b0)]);
}