bottom static method
Implementation
static int bottom(Box cube, Direction direction, List<int> moment) {
switch (direction) {
case Direction.red:
return -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)];
case Direction.green:
return -moment[getIndex(cube.r1, cube.g0, cube.b1)] +
moment[getIndex(cube.r1, cube.g0, cube.b0)] +
moment[getIndex(cube.r0, cube.g0, cube.b1)] -
moment[getIndex(cube.r0, cube.g0, cube.b0)];
case Direction.blue:
return -moment[getIndex(cube.r1, cube.g1, cube.b0)] +
moment[getIndex(cube.r1, cube.g0, cube.b0)] +
moment[getIndex(cube.r0, cube.g1, cube.b0)] -
moment[getIndex(cube.r0, cube.g0, cube.b0)];
default:
throw 'unexpected direction $direction';
}
}