/** * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND * * //\\ //\\ //\\ //\\ * ///\\\ ///\\\ ///\\\ ///\\\ * \\\/// \\\/// \\\/// \\\/// * \\// \\// \\// \\// * * EXPERTS ONLY!! EXPERTS ONLY!! * * This file implements the mapping functions needed to lay out the physical * cubes and the output ports on the panda board. It should only be modified * when physical changes or tuning is being done to the structure. */ static final float SPACING = 27; static final float RISER = 13.5; static final float FLOOR = 0; /** * Definitions of tower positions. This is all that should need * to be modified. Distances are measured from the left-most cube. * The first value is the offset moving NE (towards back-right). * The second value is the offset moving NW (negative comes forward-right). */ static final float[][] TOWER_CONFIG = new float[][] { new float[] { 0, 0, RISER, 4 }, new float[] { 25, -10, RISER, 4 }, new float[] { 50, -22.5, FLOOR, 5 }, new float[] { 17.25, -35.5, FLOOR, 6 }, new float[] { 43.25, -51.5, RISER, 6 }, new float[] { 69.25, -56, FLOOR, 6 }, new float[] { 12.75, -62.5, RISER, 4 }, new float[] { 38.75, -78.5, FLOOR, 5 }, new float[] { 65.75, -83, RISER, 5 }, }; public Model buildModel() { List towers = new ArrayList(); Cube[] cubes = new Cube[200]; int cubeIndex = 1; float rt2 = sqrt(2); float x, y, z, xd, zd, num; for (float[] tc : TOWER_CONFIG) { x = -tc[1]; z = tc[0]; y = tc[2]; num = tc[3]; if (z < x) { zd = -(x-z)/rt2; xd = z*rt2 - zd; } else { zd = (z-x)/rt2; xd = z*rt2 - zd; } List tower = new ArrayList(); for (int n = 0; n < num; ++n) { Cube cube = new Cube(xd + 24, y, zd + 84, 0, -45, 0); tower.add(cube); cubes[cubeIndex++] = cube; y += SPACING; } towers.add(new Tower(tower)); } return new Model(towers, cubes); }